<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=269747997384049&amp;ev=PageView&amp;noscript=1">

AVIO Insights

Oracle Service Bus 12c – Exposing a Pipeline as a REST Service

Within Oracle Service Bus 12c, there are several ways to implement a pipeline as a REST service.

One approach is to REST enable an existing SOAP service. In this scenario, a pipeline is supported by both SOAP and REST based interactions. A video that provides a good overview of the required steps to implement this can be found here.

Another way is to derive it from a pipeline WSDL (REST bindings in OSB 12c are based on a WSDL document). The steps below detail the configurations required to accomplish this.

The first step is to create a pipeline that is a WSDL-based service. If the WSDL does not exist, it can be generated from a schema. To do this, select the ‘Create a WSDL’ icon in the Pipeline Service creation wizard to open the Create WSDL dialog.  Before selecting ‘Finish’, be sure the ‘Expose as a Proxy Service’ is not checked, since we will be generating a REST based proxy in a later step.

When selecting the schema to base the WSDL from, be sure to select an element type. REST services derived from WSDLs cannot be based off a schema type, only an element types are supported.

Once the WSDL is generated and the pipeline service is created, there are two options to start the REST proxy creation process. One is to right click on the pipeline to ‘Expose As REST’, the other is to right click in the Proxy Services pane in the overview editor and select ‘REST’:

 

Option One:

Option Two: 

 

 

If the second option is chosen, an additional step is required to add the operation bindings. As shown below, select to ‘REST enable component or reference’, then select the pipeline service that is to be REST enabled.

For either option, the operation bindings need to be configured within the ‘Create REST binding’ wizard.  To do this, select the operation, then select the edit operation binding:

During the creation of the WSDL, if the interface type chosen was synchronous, then the default HTTP verb will be ‘Get’ and the input parameters will be available to be edited, as shown below.

On the other hand, if a one-way interface was chosen, the HTTP verb will default to ‘Put’. The parameters are already configured when the WSDL was generated, so nothing further needs to be done.

The payload can be configured to accept or return (within the Request and Response tabs) XML, JSON, and/or URL-encoded media type.  There is also an option for no payload, if it applies. Regardless of which option is chosen, the message will be translated from/to XML before it enters the pipeline.

Also note the button to the right of the Payload specifications. When selected, it will display a sample payload, based on the selected media type.

Once the configuration of the REST proxy is complete, you will notice the creation of the WADL file in the project now. This was done automatically during this process. The REST enabled proxy is now ready for use!

2 minute read