Sunday 14 October 2018

SOA 12c RESTAdapter : Creating a REST Binding


In Oracle SOA Suite 12c we have the much awaited REST adapter, which allows easily integrate REST into your services for XML, JSON or URL-encoded payload.

This is what you should do if you want to expose your service using a REST binding.

We will create a REST POST web-service which  will receive either XML, JSON or URL-encoded parameters and pass them to the BPEL.

Steps:

1. Create new SOA Application and Project
2. Create/Import your schema/XSD file
 If you want to create a schema from scratch, on the 'New Gallery' choose the 'XML Schema'

3. Next we drag a REST Adapter from the Components Palette into the Exposed Services column at the composite.xml, this will bring up the 'Create REST Binding' wizard



Next

4.  At the 'Operation Bindings' section, click on the 'green plus sign' and then click on  'Add operation binding', this will bring up the 'REST Operation Binding' wizard:



5. Provide an Operation Name, define your HTTP verb as POST



6. At the 'Request' tab you will see the options offered for payload: XML, JSON, URL-Encoded and No Payload. Select all except 'No Payload'

7. At the Schema URL field available, we will click on that one’s search icon and select the  'Input' element on the XSD.


8. Click on the 'Generate Sample Payload' button to create sample input payloads.

9. Repeat steps 6 and 7 for 'Response' tab.

10. Click OK to create the operation and OK again on the 'Create REST binding' wizard.

11. Create a Synchronous BPEL process, drag a BPEL component to the composite.xml screen.

12. On the creation wizard, at the Input/Output section, select our XSD element for both and uncheck 'Expose as a SOAP Service'

13. Your  composite should look like below



14. Connect your BPEL and Adapter.
15. In your BPEL add Assign activity and map Input to Output variables.
16. Save all.
17. Deploy and Test.


Helpful? Please comment.

Happy Learning!!



1 comment:

  1. Hi..I have doubt in packaging of soa composite using ant .
    When the soa is packaged to a jar , I dont see any class
    files inside it like we have in other java projects.
    Also, In the ant-sa-package.xml its adding all the jar files
    (of soa/modules) in classpath while packaging but they are not
    added for runtime. So does that mean those jars are needed only
    during compile-time?

    ReplyDelete

OSB 12c : Dynamic Routing to Business/Proxy Service

Dynamic routing is a kind of  Content-based Routing pattern, which is used when the BusinessService/ProxyService path is required to be de...