Skip to main content


OSB-12C REST Adapter Implementation

Istock 682295824

Implementing REST Adapter in Service Bus

This article covers the implementation of REST adapter in Oracle Service Bus (12C). REST adapter allows an easy way of calling/exposing REST services based on a Web Application Description Language (WADL).

In this implementation, we are going to call Weather API which is a public REST API by creating a REST-based proxy and business services. This API is used to find the weather report of a given location. To do this we have created two sample schemas, one for request and other for response.

  • Request schema contains only two elements city name and Id. We can either pass a city name or an ID of the location as input.


  • Response schema contains weather report elements like wind, clouds, temperature, weather, longitude, latitude, etc.



Creating Service Bus Application and Project

  • Open Oracle 12c JDeveloper, go to File -> New -> Application
  • Select Service Bus Application in the list of items and click OK.
  • Enter a name in the Application name field and click Finish.


  • Right-click the application and select New -> Project.
  • Select Service Bus Project in the list of items and click Ok.
  • Enter the Project name, leave the Directory at its default value and click Finish.


  • We can see the SOA composite (.jpr file) under the project.



Creating REST-based Business Service

  • Open the SOA Composite Editor (.jpr file), right-click the External Services lane and select REST.


  • Enter a name for Rest Reference.
  • In the Base URI section, enter the REST API Endpoint URI.
  • Select to Enforce XML Schema Ordering. When selected, this reorders JSON payloads to match the order of elements in the XML schema. This includes inbound request payloads and responses from outbound requests.


  • Add a new Resource Path in the Resources section or double click the default resource (/) to update.
  •  In the Create Resource dialog, enter the resource path in the Relative Path field.
  • In the Full Path field, we can see the URI which we have entered in the Base URI field.


  • Click the Add icon in the Operation Bindings section, and select Add Operation Binding.


  • Enter the Operation name in the Operation field.
  • Select the existing resource path in the Resource List.
  • In the HTTP Verb, select the operation (POST, GET, DELETE, or PUT).


  • In the Request Section, click the Define Schema for Native Format icon to create a new schema from a sample.
  • Enter the Schema name, Directory Name will be generated automatically and click Next.


  • Select JSON Interchange Format in the file type and click Next.


  • Enter the JSON input in the Sample text box and click Next. We have to provide the JSON input in a detailed manner including all elements, attributes, etc. so that the generated schema defines the structure of JSON data for interaction.


  • In the next dialog, we can see a schema generated based on the JSON input. Click Next
Oracle - Guide to Oracle Cloud: 5 Steps to Ensure a Successful Move to the Cloud
Guide to Oracle Cloud: 5 Steps to Ensure a Successful Move to the Cloud

Explore key considerations, integrating the cloud with legacy applications and challenges of current cloud implementations.

Get the Guide


  • Click Finish. In the URI Parameters section, we can see the parameter list with style, type, and expression.
  • Click the Response Tab.


  • Enter the operation name in the Operation field.
  • Select the existing resource path in the Resource List.
  • In the HTTP Verb, select the operation (POST, GET, DELETE, or PUT).
  • Select XML and JSON checkboxes in the Payload type.


  • Similar to Request, In the Response section, click the Define Schema for Native Format icon.
  • Enter the Schema name and the Directory path will be generated automatically under the project and click Next.
  • Select JSON Interchange Format in the file type and click Next
  • Enter the JSON input in the Sample text box and click Next
  • In the next dialog, we can see a schema generated based on the JSON input. Click Next


  • Request and Response configurations are done. Click OK to finish.


  • We can see the REST-based Business Service in external Services. Also, we can see the Resources folder under the project with WADL, WSDL, API Request and Response Schemas.



Creating REST-based Proxy Service

  • Open the SOA Composite (.jpr file). Right-click the Proxy Services lane and select REST


  • Enter the Proxy name, leave the Resource Path as it is.
  • Click the Add icon in the Operation Binding section and select Add new operation binding.


  • Enter the Operation Name in the Operation field.
  • Select POST method in the HTTP Verb.
  • In the Request tab, click the Browse for Schema File icon and select the Request Schema


  • Click on the Response tab and select the Response schema.


  • Click Ok to finish, we can see the Proxy service generated with WADL and WSDL files.



Creating a WSDL based Pipeline for Proxy

  • Open the .jpr file, in the Pipelines/Split Joins lane, Right Click -> Insert -> Pipeline.


  • Enter the Pipeline name and click Next.


  • Select WSDL as Service Type and click the Browse WSDLs icon.


  • Select the Proxy Service WSDL and click Finish.


  • We can see the Pipeline added in the .jpr file.


  • Right-click on the Proxy Service and click Edit.


  • Click the Search icon in the Target Service to add the Pipeline.


  • Select the Pipeline and click Ok.


  • We can see the wire between the Proxy Service and the Pipeline.


  • Right-click the Pipeline and select Edit.
  • Add PipelinePairNode.
  • Right-click the Stage under Request Pipeline and add a Replace action.
  • Select the XSLT Resource to transform the Request to API request.


  • Add a Service Callout action to call the REST Business Service.


  • Again add a Replace action for API Response to Response transformation.


  • We can see the wire between Pipeline and Business Service.


  • Deploy the Project in Oracle 12c Service Bus Console
  • Go to Proxy Service and click on the Launch Test Console icon to test the project from the console.


  • Enter the city name in the request to get the Weather report of that location.


In the above implementation, we have used a REST API that obtained it’s parameters from GET request and returned a JSON response which is new in SOA Suite 12C. It is then converted into XML format for further processing

Thoughts on “OSB-12C REST Adapter Implementation”

  1. Hi friend,
    Can you share the XSLT file?
    I lost in that part, when you add a replace component.


  2. Hi again
    Dear friend
    Can you tell me, how can I obtain the URI of the proxy service based in REST? I’m looking for WALD but I can´t see anywhere

  3. Venkatesan Jayaraman Post author

    It’s a simple one to one xsl that you can do it using 12c Jdev. In the replace action i have selected XSLT Resources to configure XSLT.

  4. Venkatesan Jayaraman Post author

    Right click on the proxy service, click Edit and then select Transport tab you will be able to see the Endpoint URI of the proxy. You can also modify the Endpoint URI based on your requirement.

  5. Hi ,
    CAn you share the artifacts for the above code . I’m new to this and would appreciate your help

  6. Anshul Mittal


    I want to configure a rest adapter with “PATCH” as a http verb, but there is no such option coming while creating rest service. Could you please tell me how do I configure rest service with http method as “PATCH”

  7. Hello,

    Have a small query. How to virtualize rest api webservice with our own uri/url. Can you please guide me on this.


  8. Hi,

    I folowed the similar steps, now I see an error as Rest Business service returned HTTP rsponse with status code 406. Could yu please let me know what is wrong in the configuraion.

  9. Can you please provide the code for this service.I am trying consume REST service which takes JSON request and responds in JSON .I am using REST bidning and trying in OSB 12C in version.

    REST reference binding is not able to convert XML to JSON.Proxy service is XML based proxy.Proxy service sends XML to REST based business service calling REST API that accepts JSON payload.

  10. Venkatesan Jayaraman Post author


    The business service is failing because the weather api which i have used in this blog is changed now its asking for a valid key, so to access this you need to register here once you registered you will get a valid key and you have to send it as a parameter to the api to get weather report.

    Example of API call:{APIKEY}

  11. Venkatesan Jayaraman Post author


    You have to do transformation before calling the REST business service, you have to create a xsl to transform the XML from proxy schema format to REST business service JSON format.

  12. Hi Venkat.. excellent blog it is to understsand the rest implementation in osb. Could you please advice on the post method and semantic url usage for rest service in osb. Thanks.

  13. This explanation is very good so thank you! Similar to the struggles of others I’m having difficulty with the XSLT. Can you share the file – or better, share the steps using the 12c features to convert the file. Thanks!

  14. Hi Venkat,

    Is it possible to test the Business Service(REST configured) alone from SBConsole?

    I created a Proxy/BusService similar way and while testing BusService from sbconsole(submitted thro SOAP request) I get below error message.
    Any help will be appreciated. (when I submit request using ‘REST’ tab it works fine)

    Error Message:

    No acceptable representation for response with “text/plain;charset=utf-8” media type was found No acceptable representation for response with “text/plain;charset=utf-8” media type was found

  15. Hi All,
    Our requirement is to use text/xml in mediaType. However I unable to use this option in OSB, can you please guild me with this.

  16. Adilson Vahldick


    After this moment, “Enter the JSON input in the Sample text box and click Next. “, the system throws an exception: noclassdeffounderror for JsonFactory in jackson. Do you have any idea how can I solved it?

  17. Hi Venkatesan ,

    Can you just share the Response Schema XSD so that it ll be helpful for me to practice

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Venkatesan Jayaraman

More from this Author

Follow Us