Thursday 16 February 2017

Retrieve or set a HTTP header from Oracle BPEL

First step is to add a property to the binding.ws element of the service in the composite.xml.
Add a property with name oracle.webservices.http.headers and as value the HTTP headers 
you want to use in BPEL
<property name="oracle.webservices.http.headers">username,message</property>


Next step is to define some BPEL variables for those HTTP Headers


In the receive activity of the BPEL process we can use fromProperty to copy the HTTP header property 
value to the BPEL variable. 

Do this in the BPEL source mode. 


Now you can use these variables in BPEL, I will use these vars in the return message.

Let's invoke the service from soapUI, we need to set the HTTP header properties with their values.













When we want to invoke a reference service and we also want to set some HTTP header properties.

We need also need to set the http.headers property on the binding.ws element on the 
reference in the composite.xml

<property name="oracle.webservices.http.headers">username,message,message2</property>


On the invoke of the reference service we need to use the toProperty and set the BPEL vars to these 
HTTP header properties.
I changed the toProperties to inputProperty and the Header information was being 
passed successfully.













When we test it again in soapUI we can see the invoke request of the soapUI mockservice, this contains 
the HTTP headers which we set in the BPEL process.


No comments:

Post a Comment