Time for action – declaring the cancel operation on the BPEL process interface

To add the cancel operation to the BPEL process WSDL interface, we will proceed as follows:

  1. We will open the BookWarehousingBPEL.wsdl interface.
  2. We will scroll down to the declaration of the BookWarehousingBPEL port type. We can see that the port type specifies a single process operation:
    Time for action – declaring the cancel operation on the BPEL process interface
  3. We will add the cancel operation, which the client will use to cancel the running BPEL instance. In our example, we will use the same input message as in the process operation:
    Time for action – declaring the cancel operation on the BPEL process interface
  4. Next, we will add the cancel operation as the trigger for the OnEvent event handler. We will open the BookWarehousingBPEL.bpel process and double click on the OnEvent activity.
  5. A window will pop up, where we will specify the partner link, port type, and operation name. We will specify the client partner link, the BookWarehousingBPEL port type, and the cancel operation. For the variable, we will type the cancelInputMessage name and select Message Type as BookWarehousingBPELRequestMessage, as shown in the following screenshot:
    Time for action – declaring the cancel operation on the BPEL process interface

What just happened?

We have added the cancel operation declaration to the WSDL interface of the BPEL process. We will use this operation to cancel the current running process instance.

We have also specified that this operation is the trigger for the OnEvent message handler, which has generated the following code:

What just happened?

Specifying message event activities

Next, we will add the message event activities. This means that we will specify the activities that should be performed once the cancel operation triggers our event handler.

We will throw a fault with the name CancelInstance and terminate the process instance. We have chosen to throw the fault, as this would allow a BPEL process to invoke compensation and termination handlers, if present. We will see more on compensation in Chapter 11, Compensations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset