Sunday 12 February 2017

Generic Rest Service/Generic Routing using Oracle Service Bus (OSB) 12c

Below is the sample to demonstrate creating a micro service using Oracle SOA 12c which can dynamically call any Rest Service. Here I am using DVM configured method name (GET, PUT, POST), content-type, Accept, host, queryparams and headers.
Lets Start
Create a new Service Bus Project GenericRouting





Because we are creating a generic service which can be integrated with different systems, the request and response should accept any XML/JSON. SO, first we will create xml schema (xsd) to handle anyType request/response, name it as generic.xsd
Below are the generic request and response elements definition

The above xsd is generalized to handle any kind of request/response (Json/xml), systemid is the unique identifier used to get the hostname, request parameters from dvm
Let’s create a dvm to understand the attributes

The DVM has system ID, Method name, Host, params
Create a Generic Rest Service, here I am using traditional HTTP adapter instead of REST Adapter (It was not working)

Create the Pipleline pair













Now Add the Message Type as defined below
Wire them






Go into the Piplelinepair and u will see the Routing is automatically added
We have to construct the Request by using DVM, add a New PipelinepairNode. Below screenshot will explain the steps

I am constructing Request variable gathering all the parameters, considering the request payload.
Custom are the params which I am matching with names available in DVM and later I will assigned there values

Add Insert Activity to construct Query Parameters, methods, Body if it is POST




Below id the Response from the Rest


1 comment: