Monday, August 18, 2014

Pass Header variables from SOA to OSB

I had quite a hard time finding the solution for how to pass the headers from SOA to OSB. I did a lot of R& D and don't know what exactly clicked but some how i got it working. I am drafting all the steps that i have done to pass the headers. This will help you to by pass doing a lot of experiment to achieve the functionality.I tried passing headers from SOA by a lot of ways. Such as using properties in invoke activity.Then i enable get All headers in OSB option but some how i was not able to get any header data in the $header context variable. I tried to do logging for $inbound and $header variable but i couldn't get the details passed from SOA



Scenario:

The requirement was to send the file name(custom defined) to the target system. The actual payload to the target system was not having any field to hold the fileName so we proposed to pass the same using headers.

Steps to make it working:

First is to create a variable to type string in your BPEL process.I named it as FileName



Next is create a property variable while calling the partnerlink using invoke activity. Go to the source code of your invoke activity which is calling the OSB service and add a property as shown below



Here fileName is the name of the property variable and its value is coming from the variable that we have created earlier "FileName". Now before the invoke activity you have to make sure that the "FileName" variable has the been mapped with the actual custom name of the file which you wanted to send to the OSB.

Now this will send the data to the OSB as a header section.The important point to note down is that we are passing the values using headers and not SOAP action.This is all the change that you need to do in SOA side.

Now in OSB when you create a proxy service you have to do following things

Select get All headers options in OSB



Next while publishing it to end system , Use transport headers and select Name as fileName and in action select "Pass Header through individually". Save all the changes and complete the wizard.



now test your service you should be able to see the transport header getting passed from SOA to OSB

No comments: