Tuesday, October 11, 2016

ODI Invoke Web Services with dynamic values

The ODI Invoke Web Service utility is extremely handy and lots of users are already using it in their systems. The tool allows to invoke an operation on a web service by the specified port number. Once we provide with all the required parameters, we can use the ODI tool OdiInvokeWebService to meet our required web services operation.

There are credentials to be provided when we use the command OdiInvokeWebService, and the parameters we use as per Oracle's guidelines are as below:

-HTTP_USER=<user>
-HTTP_PASS=<password>

The tricky part is what we do to encrypt or hide our credentials from all users who has access to the environment. Using OdiInvokeWebService as a tool in a Package will not help us hide it. Instead we will use an ODI Procedure to achieve this.

First we will create an ODI procedure, and select the technology ODI Tools in the Source tab. Next, in the Topology, create a new Data Server (say X, under File Technology), and save the username and password in this Topology Connection that you want to use when you call your Web Service. In the field "Host (Data Server)", provide the <<server_name>>:<<port>> details. It is interesting to note that the credentials even if entered incorrectly here will work here if you do "Test Connection". So we shouldn't get misleaded by it, instead we should make sure we can login to the Web Service or Analytics or BI Publisher URL using these credentials to make sure they are correct, and then use them in this Data Server X. In X, create a new Physical Schema with some path (you may or may not use it later) in the server. Then let's tag this Physical Schema to a Logical Schema Y in the default context Global.

Now in the ODI procedure, in the Target tab, select the Technology you used for creating the Data Server X (say File), and then select the corresponding Logical Schema Y. Then in the Source tab we can use the below in place of the credentials. It will automatically retrieve the values we have saved in the Data Server X.

<%=odiRef.getInfo("SRC_USER_NAME")%> - This will dynamically fetch the username
<@=snpRef.getInfo("SRC_PASS") @> - This will dynamically fetch the password
<%=odiRef.getInfo("SRC_DSERV_NAME")%> - This will dynamically retrieve the instance URL

Thus we can see, for Dev or Test or Prod, we do not need to change the code with the above 3 information every time. Instead the same code will dynamically retrieve these details if we simply keep the Topology information updated with the instance specific details. The Topology thus provides incredible flexibility to Developer and Administrators and saves a lot of effort if used wisely. Do you have any ideas to use the Topology in more interesting ways?

0 Comments:

Post a Comment

Have something to share? Let me know!