Monday, May 15, 2017

Use of Tokens in SOA 11g

One of the most painful point in deploying SOA composites is changing the URLs.

Today, there are several ways, we try to make this task easy as follows -

1) Generate configuration files (one or many) and choose them during deployment
2) Ant scripts to change the urls based on environment

But SOA has provided another new approach to handle the urls, which is "Use of Tokens".

Say for example, I have a composite which calls two end systems - App1 and App2. The end point urls of both the systems are present in my composite.xml as follows.


Firstly, we will have to change these end points to their referencing variables in the code.

Create an xml file as follows. Make an entry of every url that is being referenced in your composite.
The key attribute in the xml is the referencing name and the value is the actual url.


Once the above xml is ready, you can add it to your SOA project.
The next step is to replace the urls in the composite.xml to their referencing names in the above properties xml.

Go to composite.xml in Jdeveloper, select the reference for which you want to change the url and select the flower braces symbol as shown in the below picture.

The binding urls browser shows you the reference and the existing end point URL of the service. Click on the edit button at the top right.

In the following window, first choose the token properties file that you created and saved to the composite location. Then choose the Token name for each of the current values shown.


Click on the torch beside Host and Port, it will load the entry values from the properties xml file. Choose the appropriate values.

The updated bindings looks as follows.

Go ahead and deploy the SOA composite to the server.

Now, we need to do the configurations at server level. Login to em console. Under SOA-Infrastructure, select SOA Administration and Token Configurations.


There are two ways of adding token.
1) You can either upload multiple tokens (through the xml file we created for composite) by selecting Bulk Append Tokens option. It will load all the entries from file to the server.
2) Use Modify Configuration file and add all the entries here.

Make sure that the Token names are exactly what you are using in composites. Once all entries are made, the screen looks as below.
Server needs to be restarted whenever you add new entries or make any modifications to the tokens.

Note: The urls changes through tokens impact only the location path of composite.xml. The ui:wsdl location or the uris in wsdls on the project cannot be changed through tokens.

No comments:

Post a Comment