Sunday, September 9, 2018

Retrive URL Paramater through OSB

Good-day everyone, in this blog i will be showing you a step-by-step on how to retrieve values from URL and change to a different value.

The Oracle Service Bus (osb) Test

Why do you need to retrieve values from URL?

- In the project that am currently working on, there is a task where we have to extract the values from the URL. When the data has been extracted, i then have to change/modify the value and send that data to another third party vendor.

For example:
A user dials in a number (*123*321#), from that number it will extract data about the user such as their phone number, ID and etc.  Ones the data has been extracted, it will then generate all that data into a URL (
Afterwards, from that URL we must send it through to another vendor however, the msisdn (user phone number) cannot be shown to another vendor and we must modify its value.

How to retrieve values from URL?


- First add a pipeline pair in the message flow and in each pipeline you should add a stage for each.


- Then right click on "stage1" on the request side and edit stage. Afterwards, you have to add an action which is "Assign". 


- Then click on the expression and type this in: "$inbound/ctx:transport/ctx:request/http:query-parameters/http:parameter[@name="msisdn"]/@value". This is for extracting the values which is msisdn.


- You can add as much parameter as you want but remember, you much change the code as shown:
"$inbound/ctx:transport/ctx:request/http:query-parameters/http:parameter[@name="{the value of your choice}"]/@value". Afterwards, you need to give a variable name after you extract the data as shown in the image above.

- If you wan to check the output, go to the "stage1" of the respond side of the pipeline and add an action called replace. The path should be "." and the variable should be body.


- Then go to the expression and type this in:

if you have more than 3 variables then you should add ${your variable name}. For this example i only have 3 variables.


- Afterwards, Activate your OSB and go to your proxyservice. Inside there is a parameter called "query-parameter" under "Transport" and type this in:

<tp:query-parameters xmlns:tp="">
 <tp:parameter name="msisdn" value="90876778998876" />
 <tp:parameter name="shortno" value="12" />
 <tp:parameter name="inputno" value="2" />

and execute.


- Once you have execute, you should check if the URL value matches with the number that you have input.


- If you need to extract values from URL through OSB, you should try this method because by using this method it is very it very quick and easy fetching the data. 
Make sure when testing this service is having the right name values because if you miss the value does not match, the value would not be able to show up in the respond.

No comments:

Post a Comment