I made a simple test case with soapUI which adds an username and a message as HTTP header to the service invocation. In a second testcase I will mock this service in soapUI and BPEL will invoke this service and set an extra HTTP header property.
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.
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.
Thanks for sharing this useful information. This would simplify handling http headers. I had a similar usecase in 11.1.1.3, tried several things in bpel, gave up and finally created a proxy service in OSB that can set http headers and let bpel call osb proxy service. Once we upgrade I will modify bpel to directly set http header. Thank you!!
ReplyDeleteGiven the features like httpbinding and http header manipualtion from bpel, Do you have an exmaple to invoke Rest based web service call directly from BPEL?
ReplyDeleteHi,
Deletethis comes close, use the http adapter.
http://biemond.blogspot.com/2010/05/http-binding-in-soa-suite-11g-ps2.html
thanks
Thanks for the pointer, it certainly helps in case of sending XML payload using REST but not for JSON. I know one of your old article talked about using JSON within OSB by adding JSON libraries to OSB server classpath. I was hoping to find an easy and efficient way to deal with REST/JSON directly from within BPEL.
ReplyDeleteNot possible,
Deletemaybe you can make your own owsm policy who can do the conversion for you.
thanks
Edwin,
ReplyDeleteWe are using SOA 11g PS2.
How can we achieve this in that.?
We need to pass the following custom http headers.
x_company_wss_username
x_company_wss_password
Thanks,
Siddhardha.
Sorry only ps3 and higher.
Deleteyou can ask for a backport. by the way ps2 is not so stable, please upgrade.
thanks
Hi Edwin,
ReplyDeleteI have installed SOA Suite 11.1.1.4 and weblogic server 10.1.3.4. I have deployed some composites on to the SOA Server where in i have used human tasks i.e. workflows inside the composites. I am trying to send a request from one of my webapplication but it is throwing me an exception which is described below.
<ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
javax.faces.FacesException: javax.servlet.ServletException: OracleJSP error:
javax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, 'requestInfoView' returned null
Can you please through a light if you have come acrossed it. As it is an urgent which needs to be resolved.
Regards,
Chakri
Hi Edwin,
ReplyDeleteWe are using SOA 11.1.1.6.0; I tried the steps you have listed above to access the http header variable however BPEL could not read the header variable value.
There was no error but header variable was blank; do we need to apply any patch separately?
Is there a way to propagate http header (username/password) received from caller in composite/BPEL to the web service called by BPEL - as there was in 10g?
Thanks,
Hi,
Deleteis the bpel wired to a service or is there a mediator before the bpel service component.
it should work, but to do identity propagation you should use saml.
try to set http headers and see if that works
thanks
Same problem. I'm trying to send a http redirect with a http binding setting status code 302 and Location http headers. Is that possible ?
ReplyDeleteI'm using 11.1.1.6 and cannot read or write the http header.
Can I use this on a http binding interface ?
I'm setting http response headers on the reply.
Hi,
Deleteit should work with PS5 but don't know if a re-direct will work.
thanks
Isnt this a limitation with SOA suite ?
Deletehttp://docs.oracle.com/cd/E25054_01/dev.1111/e10224/sca_bindingcomps.htm#autoId3 or it is sorted in PS6 ?
Hi Edwin,
ReplyDeleteCan this be used to pass the 'Authorization' header as well?
This would enable us to use this to pass values dynamically for Basic Authentication in BPEL (been looking for such a solution).
Thanks,
Vivek
Hi,
DeleteDon't think it is designed for this , but I think you can retrieve and pass on http headers.
Thanks
Hi,
ReplyDeleteWe are running oracle soa 11.1.1.7 and I tried to use the similar solution but its not working for me the way it worked for you. can you please confirm if I it will work with 11.1.1.7 ?
Hi,
DeleteI didn't test it on PS6 but it should work in 11.1.1.7 else you can log a support call.
Thanks
Hello Biemond,
ReplyDeleteI tried to get the HTTP Headers from an Invoke Response using the way mentioned:
In composite.xml under reference:
Set-Cookie
In bpel, under Invoke activity:
It doesn't work. I checked with HTTP Analyzer, Set-Cookie is coming back in HTTP response Header. But In BPEL in get null.
Any Help, please.
Thanks,
--Inder
Adding HTML Tags. Hopefully they would come this time:
DeleteIn composite.xml under reference:
<property name="oracle.webservices.http.headers">Set-Cookie</property>
In bpel, under Invoke activity:
<bpelx:fromProperties>
<bpelx:fromProperty name="Set-Cookie" variable="lvarHTTPSession"/>
</bpelx:fromProperties>
Hi,
DeleteDid you got it working?
Thanks
Hi Biemond,
DeleteI have raised an SR with Oracle. Will let know here if i get something.
It is working for retrieving Request Header, setting Request Header but doesn't work for retrieving Response Header.
Thanks,
--Inder
No help from Oracle yet!
DeleteIt is working for retrieving Request Header.
Working for setting Request Header. But doesn't work for retrieving Response Header.
That given me a feeling that it could be that i am doing something wrong.
Anybody if have tried it.. please share if it worked for you?
Thanks,
--Inder
Hi,
Deleteit is very simple testcase, so I think it is a bug or did you add a mediator in between.
Thanks
Hi
DeleteI have a similar requirement with Set-Cookie. Was someone able to get this working?
Thanks
This comment has been removed by the author.
ReplyDeleteHi Edwin,
ReplyDeleteI am trying to pass Authorization header which has following value : 'Basic Yw79u1jshbihchjasj=='
where, Yw79u1jshbihchjasj== represents Base64Encoded username:password
I have following configuration
1) I have added following in composite.xml under reference
property name="oracle.webservices.http.headers">Authorization
bpelx:toProperty name="Authorization" variable="Authorization"/>
/bpelx:toProperties>
I am assigning the value to Autorization(string variable) using Assign activity.
But, it is not working for me. I am using SOA 11.1.1.5
In addition, do I need to add bpelx:inputHeaderVariable="Autorization" along with the Custom Header properties?
Please help as I am not able to figure out other ways to send this Header while making a HTTP POST call using HTTP Bindings adapter
PS : I
Hi Edwin,
ReplyDeleteI am trying to pass Authorization header which has following value : 'Basic Yw79u1jshbihchjasj=='
where, Yw79u1jshbihchjasj== represents Base64Encoded username:password
I have following configuration
1) I have added following in composite.xml under reference
property name="oracle.webservices.http.headers">Authorization/property>
2) I have added following in MyBPEL.bpel under invoke
bpelx:toProperties>
bpelx:toProperty name="Authorization" variable="Authorization"/>
/bpelx:toProperties>
I am assigning the value to Autorization(string variable) using Assign activity.
But, it is not working for me. I am using SOA 11.1.1.5
In addition, do I need to add bpelx:inputHeaderVariable="Autorization" along with the Custom Header properties?
Please help as I am not able to figure out other ways to send this Header while making a HTTP POST call using HTTP Bindings adapter
Hi Edwin,
ReplyDeleteI am trying to pass Authorization header which has following value : 'Basic Yw79u1jshbihchjasj=='
where, Yw79u1jshbihchjasj== represents Base64Encoded username:password
I have following configuration
1) I have added following in composite.xml under reference
property name="oracle.webservices.http.headers">Authorization/property>
2) I have added following in MyBPEL.bpel under invoke
bpelx:toProperties>
bpelx:toProperty name="Authorization" variable="tempString1"/>
/bpelx:toProperties>
I am assigning the value to Autorization(string variable) using Assign activity.
But, it is not working for me. I am using SOA 11.1.1.5
In addition, do I need to add bpelx:inputHeaderVariable="Autorization" along with the Custom Header properties?
Please help as I am not able to figure out other ways to send this Header while making a HTTP POST call using HTTP Bindings adapter
Hi,
DeleteDid you add the patch cause I think it is not support in PS4 , I know PS3 with patch and is added to PS5.
thanks
Yes Edwin, not only the patch was missing but the SOA 11.1.1.5 is not able to understand toProperties.
DeleteI changed the toProperties to inputProperty and the Header information was being passed successfully.
But, the issue is still not resolved as the service is returning 200 OK message and I am getting following error :
javax.xml.ws.WebServiceException: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Unable to read response: org.xml.sax.SAXParseException: Content is not allowed in prolog.
Am I missing something or Is it that the HTTP Bindings adapter can't read the response header.
Please help
Thanks
Edwin- Thanks for this post. However I didnt get it working when Bpel is calling a Mediator.
ReplyDeleteI set the Reference properties for Mediator + Invoke for Mediator in Bpel.
But Bpel is not sending the Header to Mediator.
If I test mediator separately it works fine , I am working on 11.1.1.17 and used the sample for mediator from : https://java.net/projects/oraclesoasuite11g/downloads/directory/Mediator
Please suggest.
Thanks
Sam
was able to send the Header from Bpel to Mediator , But now the mediator is not able to fetch the Header value from header. Looks like Mediator always expects the header in format like :
ReplyDelete$in.header.inp1_UserNameHeader/inp1:UserNameHeader
However when i send from Bpel , it is passed as below :
SamInBpel
Test
Not sure what I am missing ?
- Sam
Hi,
Deletenever got this working with BPEL and mediator, only with BPEL.
can you set or retrieve the http properties you want on the mediator component or just some fixed ones
Hi Edwin,
ReplyDeleteI have a HTTP Binding that does a post with a XML payload as an exposed service. I've been trying to set the mime:content-type of the input and output messages to application/xml but have been unsuccessful so far. Do you know where I set the content-type anywhere in BPEL?
I've tried adding a tag in the WSDL file but that doesn't seem to work as well.
Regards,
Mark
http://stackoverflow.com/questions/21086549/bpel-unable-to-set-mimecontent-type-in-wsdl
DeleteHi,
DeleteSoa suite is not so flexible, can you use OSB or create a Java WS
thanks
Hi,
ReplyDeleteWe are unable to invoke a REST based service through BPEL using a HTTP Binding adapter. We are using jdev 11.1.1.6
1. we are passing the following header to invoke a REST based service
a) Authorization
b) X-API-Key
2. We have set the following properties in the composite.xml, under the reference tag of the service
property name="oracle.webservices.http.headers" type="xs:string"
many="false">Authorization,X-API-Key
3. Also in the BPEL we are setting the header values in the Invoke
4.The xsd for invoking the service is a complex xsd
But we get the following error while invoking the service
"unable to access the following endpoint(s): REPLACE_WITH_ACTUAL_URL"
But we are able to get a response from the service through SOAPUI application
Can you please suggest what can he going wrong here or what more needs to be done?
Thanks for the wonderful tutorial, it didn't work on BPEL 1.1 so i tried BPEL 2.0 and it's work..............
ReplyDeletedon't know why it's not worked on BPEL 1.1.............I tested it on 11.1.1.6
I am using SOA 11.1.1.7 and need to pass a custom HTTP request header to a REST service on POST method. Is there a way for passing the header using BPEL 2.0 ?
ReplyDeleteHi Edwin,
ReplyDeleteI am using Jdeveloper 11.1.1.7.0. I need to invoke RESTful service by using HTTP Binding adapter in BPEL using OAuth 2.0 . In order to use this, I need to set Custom HTTP header . I have try add header using soapui and postman and it has worked in both but I can't use it in BPEL.
I have add this in the Composite.xml file
Authorization
This has been add under the reference section.
Then, in BPEL I have create a new variable called Access_Token and add toProperties under the invoke section
After I have set this in the BPEL i still get an error and fail to pass the custom HTTP headers. Below is the error.
Error Message: Bad response: 401 Unauthorized.
Is there any solution or guide for this? I need the solution urgently.
Thanks.
Hi Edwin,
ReplyDeleteI am using Jdeveloper 11.1.1.7.0. I need to invoke RESTful service by using HTTP Binding adapter in BPEL. To invoke this RESTful service I need to use OAuth 2.0 . In order to use this, I need to set Custom header . I have try add header using soapui and postman and it has worked in both but I can't use it in BPEL.
I have add this in the Composite.xml file
Authorization
This has been add under the reference section.
Then, in BPEL I have create a new variable called Access_Token and add toProperties under the invoke section
After I have set this in the BPEL i still get an error and fail to pass the custom HTTP headers. Below is the error.
Error Message: Bad response: 401 Unauthorized.
Is there any solution or guide for this? I need the solution urgently.
Thanks.
can you please share your example along with soapui project?
ReplyDeleteHow does BPEL 10.1.3.5 supports similar kind of feature. We have such requirement that from BPEL we need to pass http-header details to ESB (via OHS). ESB could able to get but the OHS will not able to read it.
ReplyDeleteWe followed below links, but not worked for us Any clue
clemensblog.blogspot.in/2006/02/consuming-statefull-webservices-from.html
http://www.oracle.com/technetwork/middleware/ias/callingstatefulwsfrombpel-091022.html
Thanks & Regards
Venkata MR
+91 98455 77125
If it's not working in 11.1.1.6 then use below syntex:
ReplyDeleteReceive Activity:
-----------------
Invoke Activity:
-----------------
We were able to accomplish this by using BPEL Specification 2.0
ReplyDelete