Creating a REST service in Oracle Service Bus 12C

In this first REST post I will demonstrate how to make easily expose a REST service in the Service Bus 12C. I will not explain REST as quite some people have already written tons of stuff about this….Google is your friend 🙂 . Exposing a service in a REST way using the new 12C release is quite simple. Lets try and expose the ConversionRateService we previously build as a REST service.

Right click the Pipeline you want to expose and select Expose as REST.

ExposeAsREST

A popup opens where you can define the name of the service and it’s resource path. In our case I will name it ConversionRateRestService and will set its resource path to /json. You can do this by pressing the little pencil on the right.

ResourcePath

The only thing we now have to do is set the operational bindings. Click the GetConversionRate operation below and click the pencil. Another popup opens where you can set the HTTP verb which will be GET in our case. Down below you can see the request parameters and the expression of how to use them.

Binding

Now click the Response tab to define in which form we want our data returned. De-select the XML box and select the JSON box as we want our service to return JSON instead of XML.

JSON

Then press OK twice and voila. You have exposed your service!

If you want you can also expose another REST service which will return XML. Follow the previous steps but you have to remember that you cannot have two proxy services with the same Endpoint URI. So what I did, I created 2 proxy services with a different URI…..for example /financial/conversionraterestservice/1.0/xml for the xml version and /financial/conversionraterestservice/1.0/json for the JSON version. When you do that, you can leave the Resource Path of the REST binding on /

Binding

This way you can easily expose your functionality in three ways: SOAP

ExposeAsSOAP

or REST with JSON

RESTWithJSON

or REST with XML

RESTWithXML

In the next post I will show how to consume a REST service using the 12C Service Bus

3 Replies to “Creating a REST service in Oracle Service Bus 12C”

  1. Pingback: Consuming a service in Oracle Service Bus 12C using the REST adapter |

  2. Pingback: Automated acceptance testing using Fitnesse, Java and the OSB

  3. Pingback: Consuming a service in Oracle Service Bus 12C using the REST adapter

Leave a Reply

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

*