What Happens When You Invoke an Asynchronous Service Operation Using Message Events How to Invoke an Asynchronous BPMN Process Operation Using Message Events

20-12 Modeling and Implementation Guide for Oracle Business Process Management To invoke an asynchronous operation from service or BPMN process you must use a send task configured to initiate a conversation. When the BPMN Service Engine runs the send task, it creates an XML message based on: ■ the asynchronous operation ■ the input required by the asynchronous operation ■ the data association defined for the message throw event Then it sends the XML message to the service or BPMN process, and continues running the rest of the process flow. It does not wait for the asynchronous service or BPM process to answer. The asynchronous service or BPMN process receives the message and runs the requested operation. When it finishes it sends a message with the result of the operation to the BPMN process that invoked it. This message is the callback operation of the asynchronous service or BPMN process. The BPMN process that invoked the asynchronous operation must invoke the callback operation to obtain its results. When it invokes the callback operation it might receive and immediate answer if the asynchronous process completed or might have to wait until the asynchronous process completes to get an answer. Figure 20–3 Invoking an asynchronous service or BPMN process using send and receive tasks This figure shows a BPMN process that invokes an asynchronous operation defined in an external service or in another BPMN process. This BPMN process uses send and receive task to invoke the asynchronous operation

20.7.1 How to Use a Send Task to Invoke an Asynchronous Service Operation

You can invoke an asynchronous service operation using a send task. To invoke an asynchronous service operation using the send task: 1. Edit the BPM process where you want to invoke the asynchronous service. 2. Locate the point in your process where you want to invoke the asynchronous service. 3. Add a send task in the point you located in your process. 4. Right-click the send task.

5. Select Properties.

Communicating With Other BPMN Processes and Services 20-13

6. Click the Implementation tab.

7. In the Conversation section, select Initiates.

8. In the Properties section, select Service Call from the Implementation list.

9. Click the Browse button next to the Name field.

The Type dialog appears. 10. Select the asynchronous service you want to invoke.

11. Click OK.

12. From the Operation list, select the operation from the asynchronous service to invoke. 13. If the asynchronous service requires input data, then you must specify how the data objects in the project map to this input data, by configuring the send task data association. See Section 8.13, Introduction to Data Associations , for more information on how to configure data associations.

14. Click OK.

15. Follow the procedure described in Section 20.7.2, How to Use the Receive Task to Invoke the Callback Operation of an Asynchronous Service to invoke the callback operation of the asynchronous process.

20.7.2 How to Use the Receive Task to Invoke the Callback Operation of an Asynchronous Service

You can invoke the callback operation that pairs with an asynchronous service operation using a receive task. To invoke the callback operation of an asynchronous service: 1. Edit the BPM process where you want to invoke the callback of the asynchronous service. 2. Locate the point in your process where you want to invoke the callback operation of the asynchronous service. 3. Add a receive task in the point you located in your process. 4. Right-click the receive task.

5. Select Properties.

6. Click the Implementation tab.

7. In the Conversation section, select Continues.

The Properties section changes, and the Initiator Node list appears. 8. From the Initiator Node list, select the activity in your process that invokes the asynchronous service. The content of the Properties section changes, and the Name field and the Operation list appear.

9. Click the Browse button next to the Name field to select the asynchronous process.

The Type dialog appears. 10. Select the asynchronous service whose callback you want to invoke.