Thursday, January 9, 2014

There are two types of web services. SOAP and REST web services. We usually deal with SOAP web services in Oracle SOA but we can also create RESTful web services in SOA.

RESTful web services are built to work best on the Web. Representational State Transfer (REST) is an architectural style. In REST data can be transmitted over a standardized interface (such as HTTP).

This post shows how we can create RESTful web service in Oracle SOA. Follow below steps to create it.
We will use below schema for this post.


First create one SOA project. In composite.xml file drag “HTTP Binding” adapter and start configure it.



Choose “service” from type drop-down list.

Choose request and response element from your schema.

Once you create HTTP binding adapter, drag a BPEL process to composite.xml file.


Wire your BPEL process with HTTP adapter.


 Inside BPEL process, add receive activity and link it to HTTP adapter to receive the request.


Add reply activity and link it to HTTP adapter to send the response back.

Deploy your composite.

You can test your composite using below URL.

http://localhost:8001/soa-infra/services/default/RESTfulService/http_Client?input=test&operationName=Request-Response


 Testing Results

Sample Code for this Post

7 comments :

  1. you missed step for add assign activity in bpel for wire input ( request ) and output ( response )
    without it reply will be empty

    alex

    ReplyDelete
    Replies
    1. Alex,

      This post is just to show how to create Restful service and you can add whatever logic you need inside BPEL.

      Vivek

      Delete
  2. hi vivek..
    thanks for ur post and i have a question..when i want to invoke my Asynchronous BPEL service as a Restful service, i am making it through HTTP binding adapter and it makes me confuse as how HTTP binds to the Asynchronous BPEL as if we select the Request-Response operation in HTTP,,,
    thanks in advance..

    ReplyDelete
  3. Hi Vivek,
    How to test a Rest Service using SOAPUI tool.

    Thanks in advance.

    ReplyDelete
  4. can we return json using ACCEPT:application/json http request header... any suggestions?

    ReplyDelete
  5. Hi, i want to setup the request as mentioned like below sample. Here i want to setup Doctype & schemalocation. How i can add it on top of the root element.





    4efeb43b-3d4e-46e0-907a-015b62e31959
    2017-04-12T11:58:22.112-04:00
    ....
    ..
    ...


    ....




    ReplyDelete
  6. I want to add the doctype & schemalocation on top of the root element. i have given sample in below.





    4efeb43b-3d4e-46e0-907a-015b62e31959
    2017-04-12T11:58:22.112-04:00
    ....
    ..
    ...


    ....

    ReplyDelete