IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing business processes > Building BPEL processes > Defining BPEL process logic > Dealing with faults in your process

Use fault handlers

A fault handler is a collection of specific activities that run when a fault is thrown on the activity with which the handler is associated.

The activities within the handler represent the necessary course of action to deal with the fault. Fault handlers are used on both invoke and scope activities. They run either when a fault is thrown by the process as a whole, by the invoke activity, or by an activity inside the scope activity. In these cases, the operation within the parent activity has not been committed, and it is possible to easily reverse the transaction. Place activities on paths within the handler to either deal with anticipated faults, or you can attempt to find another way to complete the operation. Each path within the fault handler is preceded by either a catch, or a catch-all element.

The following points apply when designing a fault handler:

If you catch a fault using a fault handler and you are using Oracle in IBM Process Server, you must not delete the default namespace. Also, you must provide a namespace if you are using Oracle with IBM Process Server on versions 6.1 through 7.0.0.2. IBM Integration Designer does not create a default namespace. See the technote at http://www-01.ibm.com/support/docview.wss?uid=swg21433700 for details.

To create a fault handler on an activity, do the following instructions:


Procedure

  1. Click the scope or invoke activity for which you want to handle a fault. The action bar displays.

  2. In the action bar, click the fault handler icon as shown in this image. A fault handler is created with one default catch element, and shown in the canvas in association with the parent activity. You can place as many paths in this handler as necessary, and each one is preceded by either of the following elements:
    Option Description
    Catch element Use this element to intercept and deal with a specific fault.

    You can use as many of these elements as is appropriate.

    Catch all element Use this element to intercept and deal with any fault that is not already defined in an existing catch element. You can use only one per fault handler.
  3. Populate the existing catch path with the activities that are appropriate to deal with the specific exception that has occurred.

  4. To add another path, click the fault handler to launch the action bar, and choose the appropriate element.


Results

If a fault matches more than one fault handler, then the following rules determine which catch element processes the fault:

If no catch or catch all element is selected, then the fault is rethrown to the enclosing scope. If the fault occurs in (or is rethrown to) the global scope, and there is no matching fault handler, the process terminates.


Example

To see an example of how to use a fault handler in a BPEL process that you can build and run yourself, go to http://publib.boulder.ibm.com/bpcsamp/index.html, and click Samples for V7.0 > Advanced BPEL features > Fault handling.

This example was created using an earlier version of the product, but the example can be run in later versions as well.

Dealing with faults in your BPEL process


Related concepts:
Fault activities
Raising faults
BPEL process compensation


Related tasks:
Continue processing upon unhandled faults
Typing fault variables