As a follow-on to my previous blog entry “ICS to API Platform,” I wanted to also show how a similar thing could be done for Oracle Service Bus (OSB).
The 12c release of OSB added many new capabilities to support REST services and execute REST services. It also has automatic conversions between JSON and XML payloads making it very easy to expose existing webservices to REST/JSON based services. It is also easy to consume REST/JSON services and use them just as if they were webservices.
The main issue to deal with in this use-case was to get the existing services from OSB. It does not have REST services to get details about itself. It uses standard JMX capabilities. I thought about deploying a JMX->REST utility, but I thought it would be great to keep this independent of another tool. So, I wrote a few simple java classes and I use these to get the OSB service details for publication.
The single pipeline is easy to follow. It gets a list of OSB assets. I do a filter on assets of type REST. I then call the API Platform services to get an existing list of APIs. The real work happens in the CreateAPI stage.
In here, we do a loop over all OSB REST services and if they don’t exist in the API Platform, we make a series of service calls to API Platform to expose it.
Each step is very easy. OSB automatically generates the correct JSON payload based on the XML definition. Simple mapping makes it all work.
I defined some of the API Platform services in the binding. It would be easy to take this sample and expose the rest of the services to include applications and other items.
All of these APIs are documented here:
Note: This is an internal link until API Platform is officially released.
Once this service is deployed, it can be setup to be called periodically by the Oracle Enterprise Scheduler Service (ESS) or just have it exposed and called whenever new services are deployed.
After it runs, the new OSB REST services are active in API Platform.
Here is a live demo.
Here is the code: sbconfig.jar