In this blog, I’m gonna to write a very basic example on the Oracle Service Bus 12.1.3 which shows how to create REST service in Oracle Service Bus.
After this blog, you should have learned to:

  • How to create SB(Service Bus) application with SB project
  • How to create simple REST service
  • Understanding of some basis components of Service Bus
  • How to run and test REST service

To complete this example, you must have Jdeveloper 12.1.3 installed on you computer with the integrated WebLogic.

Below are step by step procedure how to create REST service and provide response in XML/JSON both:

1) Go to File -> New -> From Gallery -> Application-> Service Bus Application with Service Bus Project:

2) Enter Application Name : RestServiceApplication and click Next

3) Enter Project name RestServiceProject and click Finish.

4) Create the folder structure as below

5) Create a schema called Rest.xsd under Schemas folder with below structure. The is very simple schema definition that will be used during REST adapter.

6) Double click on the RestServiceProject composite

7) Right click on the Proxy service swim lane and select REST adapter. REST adapter is used to create REST service.

8) Click on the + sign in the Operation Bindings section and click Add operation binding. This will allow us to create REST service operation.


9) Select GET  from HTTP verb drop down as we are gonna to create simple GET operation

10) Click browse for schema file icon and select input element of  Rest.xsd schema

11) Click on the Response tab. Select XML and JSON if you need output in both format. Click on the browse for schema file icon and select output element of the Rest.xsd schema

12) Click OK button twice

13) Right Click on the middle swim lane of the composite and select Insert -> Pipeline

14) Select WSDL radio button and click Browse WSDLs icon and select RestService.wsdl. Uncheck Expose as a proxy service and click Finish

15) Wire RestService and RestPipeLine together.

16) Double click on the RestPipeline and drop Pipeline pair node from the component pallet.

17) Drop Replace activity from component pallet in the Response pipeline

18) Select Replace activity and enter the expression as below:

Value expression:

<output>
<greeting>
{fn:concat(“Hello “, $body/exam:input/exam:name)}
</greeting>
</output>

19) Composite will look like.

Service has been completed. It’s time to test the service.

20 ) Right click on RestService and click Run

21) Enter name and click Execute button, you will see the output in XML format

22) Go back and select application/json from Accept drop down to get response in json format.

23) Click Execute

So we have completed a very basic example of Service Bus.

Some helpful example:

REST Service with DB adapter Oracle Service Bus

Consume REST service in Oracle Service Bus

Poll database using DB adapter in Oracle Service Bus

Secure REST service in Oracle Service Bus using OWSM(Oracle Webservcie Manager)