Exposing BPMN process as a service
A common integration requirement is to expose the BPMN process as a service. There are cases when you need to expose Oracle BPM services to be consumed by BPEL, Mediator, and more specifically, by Oracle Service Bus. Exposing process as a webservice is a built-in capability of Oracle BPM. Process instance creation or process notification can be exposed as a service.
In a real world scenario, it would not be practical to have tasks initiated from within the BPM Workspace using the User Task Initiator component as you were doing till now. So you would use the SalesToContract
BPM process as a web service.
All the BPMN processes that define a process interface appear in the SOA Composite. To connect to a BPMN process using a custom web service client you need the following information:
In this section, you will learn to expose the BPMN process as a service :
- Go to JDeveloper | Project | Composite.xml.
- Delete the ReadQuoteRequest service you have created to listen to the JMS queue:
- Right-click on the Start activity and select properties.
- Select Define Interface from the drop down,as Implementation, in the Properties area.
- Click the green plus (+) icon to add arguments.
- In the Create Argument dialog, enter name as'QuoteInput' for the input argument and select type as Component.
- Click on the "browse" button to browse for the components and select Quote from the list.
- Click on Ok twice to reach back to Properties of the Message Activity.
- Expand the Advance section, check the Asynchronous operation, and enter
requestoperation
as operation name. - Check data association, click on edit pencil button to edit the data association.
- Drag-and-drop quote from objects into the Output QuoteRequest message.
- Click on ok twice.
- When you have finished this, click on Save.
- Go to End activity and right-click on it.
- Select properties and go to Implementation tab.
- Select Implementation Type as Message, you will observe that conversation will be continuous.
- Select Initiator Node which is QuoteRequest in this case.
- Expand the Advance section and give
operationQuoteCallback
as name of the call-back operation. - You BPMN process is now a service, asynchronous service. Hence, would have a call-back operation too:
- Create a data association if you want this BPMN Asynchronous process to return data.
- Let's assign quote objects as output.
- When finished, click on Save.
When you create a BPMN process with a message Start event and a message End event, it becomes a service provider. This service can be invoked from a web service, web service client, BPEL Service, OSB Service, or from the service task of another BPMN process
The BPMN process that you have converted into a service is an asynchronous service, because the operation type of its message Start event is asynchronous. However, if the operation type of its message Start event is synchronous, then the BPMN process is a synchronous service.
You can test the process at this stage to check if the BPMN process can be invoked by BPEL, OSB, or other services.
You can either use a web service client to test it or you can create a BPEL process and invoke this service. You can even go to Oracle EM console to fetch the endpoint URL of the service and can use the default to test the service.
To connect to a BPMN process using a custom web service client, you need the following information:
Invoking BPMN process asynchronous Service
- Log in to Oracle EM Console as WebLogic user
- Click on the Service Endpoint and WSDL button and copy the Endpoint URI of the service:
- Visit the Endpoint URL in a browser.
- You will find an HTML Test page, which you can even use as XML source to enter Quote data.
- You can verify requestoperation, which you provided when implementing the
Start
message event: - Enter Quote data and click on Invoke, at the end of this HTML page.
- You can find an instance being created in a running state.
- Click on the instance and go to the Audit Trail page.
- Click on the Audit Trail tab and verify instance creation and input payload.
- Now you have WSDL, which can be used to invoke this BPMN asynchronous service.