ActiveBPEL® Designer User’s Guide

Tutorial Part 6: Adding Fault Handling

To start at the beginning of the tutorial, see Introduction to ActiveBPEL Tutorial.

Fault handling in a BPEL process is reverse work, undoing the partial and unsuccessful work of a scope in which a fault has occurred. When a fault occurs, normal processing is terminated, and control is transferred to the corresponding fault handler.

So far in the tutorial, you have completed a BPEL process definition that contains all the steps for normal processing. Now you will add a fault handler to handle a service invocation fault.

If the loan approval process throws a fault, it terminates the process via a standard fault, and turns over control to the fault handler activity.

In the loanServicePT.wsdl file, there is a fault name and a fault message defined for each of the WSDL’s operations, namely the request, check, and approve operations. The loan approval process uses the fault name and message in defining fault handling activities for the customer, assessor, and approver services.

In the Navigator view of ActiveBPEL, you should have the following files:

By completing Part 6 of the tutorial, you will be able to:

Step 1: Add a Catch fault handler and fault variable

Upon receipt of an inbound fault message, a fault handler assigns the fault message to a variable before proceeding to perform an activity enclosed by the catch.

  1. Click on the Fault Handlers tab of the Process Editor.
  2. From the Other palette, drag a Catch activity to the canvas.
  3. Select the catch handler (Ensure the selection box encloses the activity).
  4. In the Properties view, select Fault Variable Definition, and click the Dialog Button at the end of the row.
  5. Fill in the Fault Variable Definition dialog as follows and click OK:
    1. Select the Message Type radio button.
    2. From the list of messages, select lns:errorMessage.

    Variable Definition dialog

  6. In the Properties view, select Fault Name, and click the Dialog Button at the end of the row.
  7. Select the Fault Name, which is the WSDL fault name associated with both the assessor and approver services. The fault name is shown in the example.
  8. Fault Name dialog

  9. In the Fault Variable field, type error, which is the name we will associate with the fault variable definition. The properties for the Catch activity should look like the following example:
  10. Properties for error variable in Catch activity

Also notice that a new variable named error has been added to Process Variables view. This variable is exclusively for fault handling, indicated by an icon that differs from normal process variables.

process variables view with fault variable

Step 2: Add a fault handling activity

When a fault is caught, the fault handler must execute an activity. We will add a Reply activity to tell the customer that the process was unable to handle the request.

  1. From the Activity palette, drag a Reply activity into the Catch handler, as shown.
  2. Reply activity in catch handler

  3. Fill in the properties for the activity to handle the fault, as shown in the example. You must select them in the following order: Partner Link (customer), Operation (request), Fault Name (unableToHandleRequest), Variable (error).
  4. Reply activity properties, inlcuding Fault Name

The process can now catch a fault from either the loan assessor or the loan approver service. This is because both services define the same fault name and message. For the loan approval process, it makes sense to add one fault handler to the process as a whole. As an alternative, we could have designed the process to include individual fault handlers for each invoke activity.

Tip: Instead of filling in the Reply’s properties manually, you can use the Operation Wizard to drag the Web References’ request operation to the Catch activity. When the wizard opens, select Reply with Fault to automatically fill in the Reply’s properties shown in the example above.

Proceed to Tutorial Part 7: Adding Compensation and Correlation.