To wait for the callback using the <pick> activity, we will do the following:
Add the <pick> activity by dragging-and-dropping it to the BookWarehousingBPEL process. Place it immediately after the <invoke> activity within the WarehousingConfirmationInvocation scope. We should see the <pick> activity with a single OnMessage branch:
Double-clicking on the OnMessage icon opens the dialog box, where we need to specify the Partner Link, Port Type, and Operation:
Similarly, we will create the variable on the fly, using the green plus sign icon. We will create a local OnMessage_onResult variable:
To handle the response, we will place an <if> activity within the OnMessage scope. Within the <if> activity, we will check whether the books have been successfully warehoused. The corresponding XPath condition should look as follows:
For each branch, we will use an <assign>, where we will assign a successful or unsuccessful warehousing to outputVariable.
What just happened?
We have added the <pick> activity to wait for the onResult callback operation invocation from the WarehousingConfirmationBPEL service. The following BPEL code has been generated:
Waiting for onFault and onEvent callbacks
So far, we have specified the <onMessage> part of the <pick> activity for the onResult callback. We need to add the onFault and onEvent branches as well. We will proceed in a similar way as we did earlier.