Monday 11 July 2016

Exposing a Process endpoint as Rest Service with Basic Authentication

The momentum of REST popularity and adoption is rapidly increasing. I recently came across 80% of cases where the process service consumer asked for REST endpoints for process services. You must be aware that Oracle BPM 12C offers its extensive process API as REST (https://docs.oracle.com/middleware/1221/bpm/bpm-rest-api-ref/toc.htm). In addition is also provides the capability to expose process endpoints as REST along with SOAP.

To illustrate the mechanism, consider the following BPMN process.


by default Oracle BPM expose the message start activity through SOAP end point which is evident from the corresponding composite diagram as follows -



To Expose a REST endpoint for the same process, drag the Rest Binding adapter from the component panel and drop in the "Exposed Services" lane.


Select the checkbox "Service will invoke components using WSDL interface"; that the trick. In the next step wizard would allow you to create a Rest endpoint for an existing SOAP endpoint. While you have manually configure it, I would use the "Shortcut" option - 



This would enable you to select the component, select the BPMN process you would like to expose


In the next step, configure the HTTP Verb and click Finish. You are all set.


Select the operation binding entry, and click the edit icon. On the next screen "Generate Sample payload" button. Use the Sample Type radio options to generate the payload in your desired format. Copy the sample payload. We will use it later.

On the same screen in the "URI Parameters" section, select the "Generate Sample URL for operation" button to generate the url parameter. This is the URL to be shared with service consumer. In my case it is - http://<host>:<port>/soa-infra/resources/<partition-name>/OrderManagementBpmProject/RestService/

Post deployment, we will use this url (with server and port name substituted) from SOAPUI to test the service endpoint.



Now, to secure the Rest endpoint with basic token based authentication, right click on Rest Reference and click "Configure SOA WS Policies"; on the policy binding section add wss_http_token_service_policy.

Deploy the application.

Before we test our application, we need to configure Weblogic domain credentials. Right click on the weblogic soa domain and go to Security > Credentials. Create a Map with name oracle.wsm.security and add key named basic.credentials within the map. Provide the username and password you want the service client to pass.

In the SOAPUI create a Rest Project and "create an new REST Service from URI". Configure the username and password in the Request Property, select the proper method, configure the payload.















No comments:

Post a Comment