Pages

Saturday, May 29, 2010

HTTP binding in Soa Suite 11g PS2

With Patch Set 2 of Soa Suite 11g Oracle added the HTTP Binding to the supported Adapters. This Adapter was already a feature of Soa Suite 10g, so it is great news that is back. So when your HTTP Service returns a XML message then you can use this binding in your composite application. When the HTTP Service has a  JSON response then you can use the Spring Context Component ( With PS2 Spring Context is supported ). Lucas made a great example how you can achieve this.

In this blogpost I will show how you can use this HTTP Binding as a Service or as a Reference Adapter. I start with a Service so I can use this Service later in the Reference Adapter.
Drag the HTTP Binding from the Component Palette to the Service part of the Composite. Use Service as Type and when you want to have this Service, to return a message then you should select Request-Response as Operation Type.
Provide the Request and Response XSD and choose the right element. For the Request Message Schema you can also use the wizard.
Next step is to wire this Service to a component. Choose a BPEL component and use the Define Service Later template.

Make a wire between the Service and the BPEL component.
Open the BPEL component and a Receive and Reply Activity and finish your BPEL. When everything is valid then you can deploy this to the Soa Suite Server.

For this HTTP Binding Service Soa Suite adds two Port types to the WSDL. This means you can also invoke this Service with a SOAP message.
<wsdl:service name="execute">
        <wsdl:port name="Request_Response_pt" binding="tns:Request_Response_ptHttpGET">
            <http:address xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"  location="http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute"/>
        </wsdl:port>
        <wsdl:port name="Request_Response_pt_soappt" 
binding="tns:Request_Response_pttBinding">
            <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
location="http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute"/>
        </wsdl:port>
    </wsdl:service>

The Best way to test this HTTP Service is to open the endpoint url in a browser
http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute
This one is better then the tester of the Enterprise manager.
Here you can choose for the normal Invoke ( Soap message ) or use REST POST or GET

Or you can use the HTTP analyzer of JDeveloper, this is a great way to see the raw request and response


The HTTP binding can also be used as a Reference adapter. For example you can use the just created Service as Endpoint. Provide the Request and Response Schema's.

To test this Reference Adapter you can add a Mediator component with the same Request and Response Schema's. Expose this Mediator as a Service and wire the Reference Adapter to the Mediator and complete the routing rule.
Deploy this composite application, invoke the Mediator Service and take a look at the instances in the Enterprise Manager.

You can download my example at github
https://github.com/biemond/soa11g_examples/tree/master/SoaHTTPBinding
and in here I also have a txt file with all the request I did with the Wfetch tool.


Update by Rakesh


Testing of HTTP Binding adapter works from the browser just fine. It's just that how you pass the parameters.

Here's what I did:
I created a simple composite application with one input parameter and exposed it as REST service using HTTP binding adapter (GET). The service does nothing but add a string to the input parameter and returns back.

The endpoint looks like this:

soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService

When you go to test console it forms the test URL string like this

soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService/Request-Response?input=Rakesh

All along until now I was trying to use this URL from test console or from the browser.

...but this never works. It's not the right way to use it. If you try this it will return page not found.

What you actually need to use this is below:

soatestserver:8001/soa-infra/services/default/HelloHTTPProject/HTTPBindingService?input=test&operationName=Request-Response

Notice the changes in above URL. The Request-Response is not just after HTTPBindingService (as before), instead its passed as a parameter of operationName.

The above URL works just fine from browser and test console. The auto generated Test URL in test console is misleading.



74 comments:

  1. Hi Ed,

    I have a question on HTTP Binding. Did you successfully invoke your REST service with a web browser with following URL(without test console)?

    http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute?name=Ediwin&message=Hello

    I created a similar REST service. But it didn't work (it only resulted into "invalid request"), so I'm looking for correct URL to invoke.

    Regards,
    -Tak

    P.S.
    This blog post is very useful to learn this feature. nice post!

    ReplyDelete
  2. Hi,

    the best way is to test it with a microsoft tool wfetch like I did in this post. Then you know for sure

    http://biemond.blogspot.com/2010/08/http-basic-authentication-with-soa.html

    it can be you need to set a http header like the Content-Type
    like in this picture
    http://2.bp.blogspot.com/_earSixbe3dw/TGw3jRGB4eI/AAAAAAAADeI/fBpRYKQVkSc/s1600/http_basic_8.png

    thanks

    ReplyDelete
  3. Thanks Ed,

    Sorry, my explanation wasn't enough. Actually I successfully made a REST service using HTTPBinding. I tested it with test console and HTTP analyzer of JDev, and it worked as your this post. But I couldn't understand what URL can we use to invoke this REST service. If we make a REST service using HTTPBinding with GET operator, I assume we can invoke it with a url on a web browser, for example, http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute?name=Ediwin&message=Hello. But unfortunately a test result with my REST service was failure. It resulted into only "Invalid Request".. So if you made a service with GET operator, I'm interested in your result (invoke with url(+ query string) on a web browser)

    Regards

    ReplyDelete
  4. Hi,

    what you did is right, try to set http header Content-Type. I think it needs this , I got the same ( nvalid Request)

    thanks

    ReplyDelete
  5. Hi Edwin,
    I tested this in 11g PS3. Its not working and throwing Nullpointer exception. Did you get a chance to test this in 11.1.1.4 and if so were you successful. Is there any patch if its a bug.

    thanks,
    Satish

    ReplyDelete
  6. Hi,
    Can you give me more information because this is all standard so no special programming. This should work.

    Thanks

    ReplyDelete
  7. I have the same issue.
    Edwin, how can you post to blog w/o testing by yourself?

    ReplyDelete
  8. Hi,

    I tested and build it with in PS2 and if this does not work in PS3 then it is a bug, because there is no special user made code. So report a bug and I will also test it in PS3

    thanks

    ReplyDelete
  9. Hi,

    it seems like a PS3 weblogic / soa problem, in PS2 you can put the http endpoint in a browser and you will get an test form, in PS3 indeed you get a nullpointer problem

    it still works but you need to use a other test tool like wfetch, http://biemond.blogspot.com/2010/08/http-basic-authentication-with-soa.html

    thanks

    ReplyDelete
  10. Hi, Edwin.
    Really appreciate your help.
    According to your link (http://biemond.blogspot.com/2010/08/http-basic-authentication-with-soa.html) using Wfetch and POST/xml mode it works!

    ReplyDelete
  11. Hi Edwin,

    I am wondering how the client with 'oracle/wss_username_token_client_policy' takes username and password credentials in jdeveloper 11g?

    Regards,

    Amar

    ReplyDelete
  12. Hi,

    there are some way to set the username , password.

    set basic.credentials in the EM security keystore

    or set these properties
    oracle.webservices.auth.username and oracle.webservices.auth.password on external reference in the composite.xml

    dont think credentials are stored in jdeveloper, its done in the weblogic server

    thanks

    ReplyDelete
  13. Hi Edwin,
    I went through your post and it was really helpful. In one of my projects, I have a requirement to use both POST and GET methods in a single Bpel prosses. I need to expose a https URL(soa Composite's) to client which accepts order.xml as input. In the order.xml there will be HTTPS URLs for .pdf downloads and I need to download pdf files by calling those URLs. Can you suggest how to work with pdf downloads?

    ReplyDelete
  14. Hi,

    the post and get is no problem for bpel or soa suite. For the download I would use the SOA Spring component then you can use plain java and the apache http client and still be working in the bus.
    maybe this can help you
    http://biemond.blogspot.com/2010/06/enriching-and-forwarding-your-data-with.html

    thanks

    ReplyDelete
  15. Hi, Edvin.
    As I said before, according to your blog POST method works,
    but now I need exactly GET method and I can't understand how query string should be constructed,
    because I am constantly receiving "invalid query string" error :(

    ReplyDelete
  16. Hi,

    I know, I got the same problem and tried different tools but I don't get it either

    please ask Oracle and please let me know what they say

    thanks

    ReplyDelete
  17. Hi Ed,
    I am curious where you actually give the http link where you want to post the files. I mean , I have a process where I have to send the XML files using HTTP post, but I the client External Service just has an URL to which I have to post the XML. Where do I have to enter this if I follow your HTTP binding Method ?

    Please let me know

    ReplyDelete
  18. Hi,

    in this http://3.bp.blogspot.com/_earSixbe3dw/TAEpg_seU0I/AAAAAAAADYk/oYYfPPNzZr8/s1600/http_7.png

    thanks

    ReplyDelete
  19. Hi Ed,

    Left Swim lane has HTTP binding Service with following

    Interface : Define from operation and Schema
    type : Service
    Operation type : One-Way
    Operation Name : Send
    Verb : POST
    Payload type XML

    On an Empty BPEL , I added a Receive activity and assigned a input variable.Selected the Create instance (as it throws error saying there is no starting point) and uploaded it to Weblogic

    I get the following Error when I click on TEST web -Service after entering the Arguments.

    The selected operation Send could not be invoked.
    An exception occured while invoking the webservice operation. Please see logs for more details.
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: null
    Collapse Hide Additional Trace Information Hide Additional Trace Information

    java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: null at oracle.sysman.emas.model.wsmgt.WSTestModel.invokeOperation(WSTestModel.java:575) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:381) at oracle.sysman.emas.view.wsmgt.WSView.invokeOperation(WSView.java:298) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(Unknown Source) at com.sun.el.MethodExpressionImpl.invoke(Unknown Source) at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53) at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256) at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:765) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:305) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:185) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at
    Am I missing something in the BPEL ?
    Even the End Point URL says Error Parsing the WSDL for this end point

    ReplyDelete
  20. Hi Ed,

    I am trying to get this working for last 3 days but it looks like I am missing something. Can really make it work.

    Is is possible to uplodad the zip file of your application somewhere? I need to have a look how you have done it.

    Thanks.

    RK

    ReplyDelete
  21. Hi,

    I don't have this project in this state but what is the error you are getting.

    I know it got some issues with the em test client.

    I use wfetch for testing described in this blogpost

    http://biemond.blogspot.com/2010/08/http-basic-authentication-with-soa.html

    thanks

    ReplyDelete
  22. Hi,

    It's giving me the null pointer exception when I am trying to test it.

    The application was deployed successfully.

    I have used the GET methods for HTTP Binding.

    Here's a link to my project, if you want to have a quick look. It's really very simple and can be deployed anywhere.

    http://dl.dropbox.com/u/8289460/HelloHTTPBinding.zip

    I will try to use wfetch to see if that helps.

    Regards,

    Rakesh

    ReplyDelete
  23. Hi,

    it is a known ps3 bug, use a different test tool like wfetch or ps2

    thanks

    ReplyDelete
  24. Hi,

    I have deployed in on SOA Suite version 11.1.1.4

    I also have a SR open with oracle. Do you think that the bug is there in this version as well.

    Do you have any reference to this bug?

    I will add this to my SR request.

    Thanks

    ReplyDelete
  25. Hi Ed,

    I tried few thinks today and this is my observation.

    HTTP Binding - GET
    Did not work at all whatever combinations I tried.

    HTTP Binding - POST
    1. Simple Type Request and Response - Worked
    2. Complex Type Request and Simple Type Response - Worked
    3. Complex Type Request and Response - Did not work

    So it's fair to say that for POST method the the response must be simple type defined in XSD.

    I was able to test it both from OEM test console and wfetch Tool.

    Now the first issue I have is that the GET method is not working at all.

    The second is that to test the POST method I need to pass like this in wfetch tool:


    AA
    BB


    In response I get back:
    AA BB

    Now my question is, how can I write a simple html page to make a request and response using the POST method?

    Any help much appreciated.

    Thanks

    ReplyDelete
  26. "The Best way to test this HTTP Service is to open the endpoint url in a browser
    http://laptopedwin.wh.lan:8001/soa-infra/services/default/HttpBinding/execute "

    From your post.

    Somehow this method did not work even for POST. When I try to open the endpoint URL, always getting a null pointer exception page.

    RK

    ReplyDelete
  27. A quick update, I was wrong about the POST methods working. In fact nothing is working GET or POST for REST.

    As described in this thread that at run time, the binding is created for both REST and SOAP.

    The only thing that has worked for far for me is the SOAP binding for POST method.

    What I am looking is the REST binding.

    Any more help with this?

    Thanks

    Rakesh

    ReplyDelete
  28. It's kind of funny.

    Just got another update from oracle about the SR that I have opened for this issue.

    In the update, instead of giving any definite answer they have actually given me link of this post for reference. Just shows that the world is round :)

    Do even oracle know how this works?

    Rakesh

    ReplyDelete
  29. Hi

    heheh, good old support.

    you can better swith to OSB ( you got the license for it when you have soa suite ) and there many guide how to do this.

    with OSB you have total control.

    for outgoing you can use the spring component in combination of apache http.

    thanks.

    ReplyDelete
  30. for PS3, if you browse for end point it gives null pointer exception because in PS3 WSDL in services section it has only one port (for http) under service section. In PS2 we have 2 ports one for soap and other for http.

    Regards
    PavanKumar.M

    ReplyDelete
  31. I am not sure what you mean here Pavan. If I look at the runtime WSDL I can still see both http and SOAP bindings. Both are still there.

    Have you managed to get it working?

    Rakesh

    ReplyDelete
  32. Rakesh,

    I could see service section as below



    I did not try this in PS2. But according to Edwin's post, it says the service section should contain another port with .

    That's why I think it is working in Wfetch and http analyser.

    Correct me if I am wrong.

    Regards
    PavanKumar.M

    ReplyDelete
  33. Hi Ed,

    Can you throw some light on calling an XML-RPC based service from SOA? Is it possible ever?

    ReplyDelete
  34. Hi,


    you can take a look at these documents
    http://download.oracle.com/docs/cd/E21764_01/doc.1111/e17836/chapter4.htm

    or

    http://download.oracle.com/docs/cd/E21764_01/web.1111/e13759/overview.htm#WSOVR115

    but maybe you can do it in java and add this to the spring component of the soa suite.

    thanks.

    ReplyDelete
  35. Hi Ed,
    Thanks for the excellent blog.
    I am struck with the same issue Rajesh Kumar is facing. (i.e Null Pointer exception when I invoke the service)
    I need your advice on the following issues. My requirements are -
    1. Send a document via HTTP post (for which i am trying to use HTTP binding adapter - which i am stuck with the above mentioned error)
    2. Add custom tags in soap headers like customer name, customer location (these are hardcoded values)
    3. Is there any workaround sending soap messages (with the customer header) without using a HTTP binding adapter?

    And Rajesh, If you could share me the bug number, it will be helpful

    ReplyDelete
  36. Hi Dwarak,

    I am Rakesh not Rajesh :) Just a one letter difference.

    The Bug Reference number is 12874442. Oracle support still working on the SR. Nothing concrete yet.

    The HTTP POST method may work with XML payload.

    Remember to hit the Parse WSDL button in Test console.

    As suggested by the blog author, try using wfetch (microsoft tool). You can use SoapUI or JDeveloper HTTP Analyzer as well.

    You may try OSB as well. Although I got a totally different result on OSB. On OSB, HTTP GET is working fine for me but not HTTP POST :( Not sure what I am doing wrong.

    Cheers

    Rakesh

    ReplyDelete
  37. @Pavan - I am not sure why or what you cant see but I can see port binding for both REST and SOAP in the example I am working on.

    ReplyDelete
  38. Hi,

    We are running Oracle SOA 11g (11.1.1.2.0) is there any option to disable "test form" while typing endpoint URL in browser. This is required for security resons. So the production URLs cannot be invoked through browsers.

    thanks
    Arunachalam.C
    Dubai-U.A.E

    ReplyDelete
  39. Hi Ed,
    Can you give some direction / best practice in how to implement a service (webservice or http) which replies an image (binary content) to the client.

    My requirement is , client calls the BPEL by sending a URL of image, BPEL has to read that image and send back to client.

    Can I use HTTP Binding to achieve this ?

    Thanks
    Sreeny

    ReplyDelete
  40. Hi,

    in the response use a xsd with a base64Binary element and use this blogpost to fill it from bpel.

    http://biemond.blogspot.com/2011/09/base64-encoding-in-oracle-bpel-11g.html

    Maybe if the image comes out of a database you can do a mapping between a db adapter and bpel.

    thanks

    ReplyDelete
  41. Hi Ed,

    A quick update.

    In response to my SR 3-4198774021: HTTP Binding (Service Adapter) not working, that I opened 3 months back, oracle has finally provided a patch 12874442. The patch is available through official channel.

    If you need the patch, let me know I will send it to you. It's only 28kb in size, quite small. This is for SOA Suite 11.1.1.4

    It is supposed to fix the issue that I have experienced. I haven't tested the patch due to DBA unavailability (working in official environment and all).

    I hope to have this tested by next week and post my findings.

    Hope this information helps someone who is experiencing the same problem.

    Thanks

    Rakesh

    ReplyDelete
  42. Thanks

    is this the patch, where you in PS3 just can add the url of the service in a browser to test it.

    instead of using wfetch

    thanks

    ReplyDelete
  43. Yes its the same patch and it should sort out the issue of java error when trying from the test console as well.

    For me only SOAP binding worked never the REST.

    So hopefully it will sort out these issues.

    I will give an update as soon as I get to try it.

    DBAs still unavailable in my company due to to oracle ERP upgrade to R12.

    Hopefully they will apply the patch early next week.

    I asked you another question about Kerberos in your other post. Do let me know if you find some time.

    Thanks

    Rakesh

    ReplyDelete
  44. Here's the update.....

    It's a bit stupid from oracle's part. It was all along working, I don't know why they provided a patch for this and I am not sure what the patch actually does.

    Testing of HTTP Binding adapter works from the browser just fine. It's just that how you pass the parameters.

    Here's what I did:
    I created a simple composite application with one input parameter and exposed it as REST service using HTTP binding adapter (GET). The service does nothing but add a string to the input parameter and returns back.

    The endpoint looks like this:

    soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService

    When you go to test console it forms the test URL string like this

    soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService/Request-Response?input=Rakesh

    All along until now I was trying to use this URL from test console or from the browser.

    ...but this never works. It's not the right way to use it. If you try this it will return page not found.

    What you actually need to use this is below:

    soatestserver:8001/soa-infra/services/default/HelloHTTPProject/HTTPBindingService?input=test&operationName=Request-Response

    Notice the changes in above URL. The Request-Response is not just after HTTPBindingService (as before), instead its passed as a parameter of operationName.

    Here's the reponse:

    Hello test! From SOA World.


    The above URL works just fine from browser and test console. The auto generated Test URL in test console is misleading.

    I haven't seen any oracle documentation that says you have to pass the operation name parameter but it looks like the right way of doing it.

    I am yet to try out the post method but if GET works the POST should work as well.

    After 4 months it looks like I am finally getting there :)

    Rakesh

    ReplyDelete
  45. Here's the update.....

    It's a bit stupid from oracle's part. It was all along working, I don't know why they provided a patch for this and I am not sure what the patch actually does.

    Testing of HTTP Binding adapter works from the browser just fine. It's just that how you pass the parameters.

    Here's what I did:
    I created a simple composite application with one input parameter and exposed it as REST service using HTTP binding adapter (GET). The service does nothing but add a string to the input parameter and returns back.

    The endpoint looks like this:

    soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService

    When you go to test console it forms the test URL string like this

    soatestserver:8001/soa-infra/services/default/TestPatchProject/HTTPBindingService/Request-Response?input=Rakesh

    All along until now I was trying to use this URL from test console or from the browser.

    ...but this never works. It's not the right way to use it. If you try this it will return page not found.

    What you actually need to use this is below:

    soatestserver:8001/soa-infra/services/default/HelloHTTPProject/HTTPBindingService?input=test&operationName=Request-Response

    Notice the changes in above URL. The Request-Response is not just after HTTPBindingService (as before), instead its passed as a parameter of operationName.

    Here's the reponse:

    Hello test! From SOA World.


    The above URL works just fine from browser and test console. The auto generated Test URL in test console is misleading.

    I haven't seen any oracle documentation that says you have to pass the operation name parameter but it looks like the right way of doing it.

    I am yet to try out the post method but if GET works the POST should work as well.

    After 4 months it looks like I am finally getting there :)

    Rakesh

    ReplyDelete
  46. Great and thanks for the update. I added your research and solution to this blogpost.

    keep up the good work.

    thanks Edwin

    ReplyDelete
  47. Hi

    I did my own testing and with the HTTP Get adapter

    I can send with POST
    /soa-infra/services/default/HttpBinding/execute?operationName=Request-Response
    With this as body
    <request xmlns="http://www.example.org">
    <name>edwin</name>
    <message>hi</message>
    </request>

    or now with GET
    /soa-infra/services/default/HttpBinding/execute?operationName=Request-Response&name=edwin&message=hi

    By the way you need to name the operation to Request-Response else I get strange strange errors and indeed the operationName=Request-Response is always required.

    With the POST HTTP binding and url encoded
    I can make it only work like this
    /soa-infra/services/default/HttpBinding/execute2

    With this as body
    <request xmlns="http://www.example.org">
    <name>edwin</name>
    <message>hi</message>
    </request>

    The operationName does not matter here ( strange , it uses the default )

    I put my example in github with the request I did with wfetch tool of microsoft
    https://github.com/biemond/soa11g_examples/tree/master/SoaHTTPBinding

    thanks

    ReplyDelete
  48. Hi Ed,

    I was away for few days for Xmas holidays :)

    I downloaded your example and I was playing around with it.

    You are right about operationName in POST method using the default (it does not matter if you provide it or not)but may I add that it's the case only when you are testing it form wfetch tool with your payload:

    \r\n
    edwin\r\n
    hi\r\n


    Next what I did is to create a smiple html page for using the POST method. I am using your example application.

    I cant post the html page here (html tags not allowed in this forum).

    I have uploaded the page here:
    dl.dropbox.com/u/8289460/t1.html

    Now when I try this html form from the browser, it is its working fine and getting the response back.

    It has three input parameters operationName, name and message. If I delete the line operationName input parameter line (line that starts with operationName) from the html page and try again it does not work.

    So again if you are using it from browser it looks like operationName is required.

    Download and give the html page a try in your environment.

    The strange thing you mentioned about the operation name that it always have to be Request-Response. I will give it a try by giving it some other name.

    Just to note that I have not yet closed my SR, had a conference call with oracle last week. They are still trying to figure out whats happening.

    We have proressed so far on this issue, might as well get to the end of it. :)

    Rakesh

    ReplyDelete
  49. thnks 4 the example..it worked and was helpful

    ReplyDelete
  50. I have one query regarding the HTTP Binding adapter. I am calling third party rest service using this adapter and using GET method (url encoded). It seems that the binding adapter adds the operation name and so the rest service fails since it doesn't have this parameter. Can you tell us how can we avoid this parameter in url?

    ReplyDelete
    Replies
    1. Don't use 'url encoded' if you want to avoid passing the parameter in url.

      Delete
  51. Just want to update this post with the info that this example works well in 11.1.1.6. I did not have to install any patch (so I guess the fix is present in 11.1.1.6).

    And using Rakesh's example, I could call Ed's service from browser as follows

    http://myhost:7001/soa-infra/services/default/HttpBinding/execute?message=test&operationName=Request-Response

    ReplyDelete
  52. Ed,

    In this article, you explained how to expose the BPEL process as a RESTful service. I am looking for an article on how to invoke/call a RESTful service from a BPEL process. Please help.

    --Santosh

    ReplyDelete
    Replies
    1. Hi,

      you can use the soa suite http reference adapter but only get and post are supported. Maybe you can also use the soa suite spring component and use it with a rest library or use OSB.

      thanks

      Delete
  53. Hi Edwin,

    Please advise below are the details and error message i am getting:

    I am trying to HTTP POST through BPEl process with HTTP Binding adapter as reference.I need to pass Content-Type and Authorization headers which i am doing though the properties in the composite.xml i.e Authorization,Content-Type.

    I am assigning values to these 2 headers through 2 variables in bpel assign activity.In the Invoke activity that invokes Http binding adapter i have below:I.e i am assiging the variables to the headers i defined in composite.xml






    When i test through EM console i get the error

    :Non Recoverable System Fault :
    Unable to access the following endpoint(s): REPLACE_WITH_ACTUAL_URL

    Non Recoverable System Fault :
    Unable to access the following endpoint(s):https://apps-apis.google.com/a/feeds/ieeetest.mygbiz.com/user/2.0

    I have spent lot of time time debugging,but not able to find solution.Please advise on this.I am
    passing xml payload which has complex types.

    Also does SOA be default sends the Content-Length header for HTTP POST or do we need to add it as
    header?..We ar eusing Oracle SOA SUITE 11.1.1.6 and jdeveloper 11.1.1.6.

    The same end point uri when i test through SOAP UI is working fine.

    Please Please Help,this is a show stopper for the project i am working.

    ReplyDelete
    Replies
    1. Hi,

      very strange, is it a hrrp proxy problem, can you use a http analyzer and maybe you make a servlet which pass on the request

      for setting header properties you can use this
      http://biemond.blogspot.nl/2012/04/retrieve-or-set-http-header-from-oracle.html

      thanks

      Delete
    2. Hi I have a problem with security.
      Http binding adapter has endpoint https://192.168.10.10:8080/uuid/453434563

      I have added my client certificate and server certificate to keystore. I have made a configuration in soa server/console keystores and ssl.


      Non Recoverable System Fault :
      ORAMED-03303:[Unexpected exception in case execution]Unexpected exception in request response operation "Request-Response" on reference "ecm". Possible Fix:Check whether the reference service is properly configured and running or look at exception for analyzing the reason or contact Oracle Support Services. Cause:Unable to access the following endpoint(s): REPLACE_WITH_ACTUAL_URL

      Should I add a policy to http adapter in composite?

      Delete
    3. Hi,

      I think it is more a HTTP adapter problem , never found it working great with external services.
      Can you make a support call

      Thanks

      Delete
    4. Hi Punya
      Were you able to figure it out, I have exactly the same requirement and except for two, I need to pass four Headers(Content-type, Accept, Connection and Authorization).
      In my scenario, i can't use the oracle/wss_http_token_client_policy as i have to pass following against
      Authorization header:
      for e.g.
      'Basic Yw79u1jshbihchjasj=='
      where, Yw79u1jshbihchjasj== represents Base64Encoded username:password
      I have following configuration based on the blog regarding Adding BPEL Headers

      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

      Delete
  54. Hi Edwin,

    Thanks a lot for your tutorial.
    I had the same challenges as outlined in the comments above.
    If it is compulsory that we specify Request-Respond Operation,
    does that mean only one operation is possible per port in the wsdl file for the HTTP Binding (POST)

    Regards,
    Tumi

    ReplyDelete
    Replies
    1. Hi,

      This was PS2, we are now at PS6 but don't know if this behaviour is current. Can you check this for me?

      Thanks

      Delete
  55. I'm attempting to call a REST service using the HTTP Binding with the XML payload, however this service isn't expecting any XML tags, it's just looking for some data in the payload. Is there any way to pass this information (I don't have any control over this service) sans the XML tags? Currently I'm sending:
    blahblahblah
    where the service is just expecting:
    blahblahblah

    Is there any way to do this using 11g? Am I missing something super basic?

    Thanks!

    ReplyDelete
    Replies
    1. Something stripped out the XML tags from my 'Currently I'm sending: ...' block

      Delete
  56. HI Ed,

    I am trying to call a third party GET call through BPEL and so i am using Reference in HTTP Binding . But the issue is that i need to pass only 1 parameter , say Accountid, but unfortunately the adapter is also adding Operation Name(&operationname) along with it in url , and so the call fails Why is this behaviour ? Can we suppress this. Any inputs are appreciated. Thanks.

    ReplyDelete
    Replies
    1. Hi,

      this adapter is not so flexible and don't think you can suppress this

      Delete
    2. I think you can do this by writing a Custom Policy and attach this to your HTTP adapter.

      Delete
  57. Hi

    I am also trying to set Header while making a HTTP POST call using HTTP Bindings adapter. I am not able to get any do so.Please help me.I have to set

    Content-type: application/octet-stream

    Please suggest.

    ReplyDelete
    Replies
    1. Hi,

      ok what is the default Content-type , probably application/xml
      maybe you can override this with setting this header property in BPEL.

      http://biemond.blogspot.com.au/2012/04/retrieve-or-set-http-header-from-oracle.html

      thanks

      Delete
  58. Hi,

    Getting this exception while invoking the Google API Webservice using HTTP Adapter

    oracle.fabric.common.FabricInvocationException: Unable to access the following endpoint(s): REPLACE_WITH_ACTUAL_URL

    ReplyDelete
  59. Hi Edwin- we have a requirement where we need to read an XML file over http without passing any Input parameter?

    e.g. http://abc.com/services/codelist/testfile.xml

    is it possible to read it using HTTP adapter?

    ReplyDelete
  60. Hi Edwin,

    It very good blog for Http adapter, I am facing one issue using http adapter. Please find below details
    SOA server : 11.1.1.7
    Jdev: 11.1.1.7.1

    My requirement simple, I have invoke REST service from BPEL, I am using http binding adapter to invoke below url
    http://xx.xx.xx.xx:8080/uaqpncp/register.html?username=uaq&password=uaq123&method=updateSubscription&deviceuid=a3b2227ebb3afe4f&subscription=1

    I have successfuly tested above url using Browser, Wfetch, and SOAPUI, getting below response.
    Wfetch Logs: *********************************
    started....WWWConnect::Connect("xx.xx.xxx.xxx","8080")\nIP = "xx.xx.xxx.xxx:8080"\nsource port: 63380\r\n
    REQUEST: **************\nGET /uaqpncp/register.html?username=uaq&password=uaq123&method=updateSubscription&deviceuid=a3b2227ebb3afe4f&subscription=1 HTTP/1.1\r\n
    Host: xxx.xx.xxx.xxx\r\n
    Accept: */*\r\n
    \r\n
    RESPONSE: **************\nHTTP/1.1 200 OK\r\n
    Server: Apache-Coyote/1.1\r\n
    Content-Length: 9\r\n
    Date: Wed, 19 Aug 2015 07:26:06 GMT\r\n
    \r\n
    success\r\n
    finished.
    ******************************

    But When I am trying to use this url in http binding adapter and invoking bpel service, I am getting below error.
    Error:
    Unable to invoke endpoint URI "http://xx.xx.xxx.xxx:8080/uaqpncp/register.html" successfully due to: javax.xml.soap.SOAPException: Unable to read response: org.xml.sax.SAXParseException: Content is not allowed in prolog.

    as per my understanding BPEL is unable read response from REST service. XML parser is not able reading this response.

    I am using xml encoding UTF-8,

    How to fix this issue. ? Please help out I am working this since 2 days.

    -Regards
    AR

    ReplyDelete
  61. plz tell me how to add my index jsp page into bpel

    ReplyDelete
  62. PDF file download through rest API in soa

    Hi ,

    I am trying to consume rest api using rest adapter/http adapter in soa 12c.This API is returning a PDF file in response.I want to write this response as a pdf file using file adapter in my local file system.
    When I test my POC on local weblogic server.

    I tried to download the file using soa but when I am using

    Rest Adapter:

    getting below error

    oracle.sysman.emInternalSDK.webservices.util.SoapTestException: Client received SOAP Fault from server : oracle.fabric.common.FabricInvocationException: java.lang.RuntimeException: Unknown media type : application/pdf


    When I used HTTP Adapter , It is giving below error:

    oracle.sysman.emInternalSDK.webservices.util.SoapTestException: Client received SOAP Fault from server :
    oracle.fabric.common.FabricInvocationException: Unable to invoke endpoint URI
    "http://phcv-dwitci01.corp.incresearch.com:81/SiteVisitReport.svc/visitId/94281182" successfully due to:

    javax.xml.soap.SOAPException: Unable to read response: XML-22004: (Fatal Error) Error while parsing input XML document (Invalid UTF-8 encoding.).

    I am still searching for the solution in soa.

    Can you help me out of this in downloading pdf file using oracle soa using Rest Adapter/HTTP Adapter.

    Regards,
    Kavindra

    ReplyDelete
  63. I love all the posts, I really enjoyed, I would like more information about this, because it is very nice. Thanks for sharing. I love all the posts.
    wire binding

    ReplyDelete