Designer > Fault Handling > Adding a Fault Handler
  

Adding a Fault Handler

Select the variable definition, either message type or element. Then select a variable from the list.
Your BPEL process can catch standard faults as well as faults from a throw or re-throw activity or service invocation. Once caught, a fault is handled by a catch activity you specify, such as a reply containing an error message or a compensate activity. While a <catch> or <catchAll> can have only a single child activity, this activity can be a structured activity that can have its own children.
There are several ways to add fault handlers, including:
For background information, see Fault Handling.

Adding a Fault Handler for the Process

You can add multiple catch handlers and one catch-all handler for the process.
For explanations of these handlers, see Defining Catch and CatchAll Fault Handlers and Catching Undeclared and SOAP Faults.
To add a catch handler for the process:
  1. 1. Click on the Fault Handlers tab of the Process Editor canvas.
  2. 2. Drag an Error catch event to the canvas.
  3. A catch handler is added and is selected.
  4. 3. In the Properties view, select the following optional values:
    1. a. Fault Name. See Fault Handling Processing Rules.
    2. b. Fault Variable. Type in name for the variable described by the variable definition. For a discussion on whether or not to add a fault variable, see Rules for Catching Faults in a Catch Activity. If you have selected a Fault Name, the fault variables picklist displays only compatible variables.
    3. c. Variable Definition. Select the Dialog (...) Button at the end of the row to open the Variable Definition dialog. See Fault Handling Processing Rules.
  5. 4. Drag an activity into the catch handler, such as a reply or compensate. For an example, see Fault Handling for Service Invocations.
  6. 5. Fill in the properties for the activity to handle the fault.
To add the catch all handler for the process:
  1. 1. Click on the Fault Handlers tab of the Process Editor canvas.
  2. 2. Drag an Error catch event to the canvas.
  3. 3. Select the Catch All Faults checkbox.
  4. 4. Do not select any fault name or variable in the Properties view of the Catch.
  5. 5. Drag an activity into the catch all handler, such as an assign or compensate.
  6. 6. Fill in the properties for the activity to handle the fault.
The following illustration shown an example of a fault handler added for the process.
Tip: If you collapse the fault handler, you can add a background color from the Properties view. Right-mouse-click the handler and select Collapse Container.

Adding a Fault Handler for a Scope

You can add multiple catch handlers and one catch all handler for each scope in your process.
For explanations of these handlers, see Defining Catch and CatchAll Fault Handlers and Catching Undeclared and SOAP Faults.
To add a catch handler to a scope:
  1. 1. Select a scope container on the Process Activities tab of the Process Editor canvas.
  2. 2. Drag an Error catch event into the scope or near the border of a collapsed scope, as the illustration shows.
  3. 3. In the Properties view, select the following optional values:
    1. a. Select the Catch All Faults checkbox and leave the other properties blank.
    2. b. Fault Name. See Selecting a Fault Name for details. For a discussion on whether or not to add a fault name, see Fault Handling Processing Rules and Rules for Catching Faults in a Catch Activity.
    3. c. Fault Variable. Type in name for the variable described by the variable definition. For a discussion on whether or not to add a fault variable, see Fault Handling Processing Rules and Rules for Catching Faults in a Catch Activity. If you have selected a Fault Name, the fault variables picklist displays only compatible variables.
    4. d. Variable Definition. Select the Dialog (...) Button at the end of the row to open the Variable Definition dialog. See Adding a Fault Variable Definition for details. For a discussion on whether or not to add a a fault variable, see Fault Handling Processing Rules and Rules for Catching Faults in a Catch Activity.
  4. 4. Drag an activity into the catch handler, such as a reply. For a boundary event, you must link the handler to an activity to execute. The activity must be an activity that has not yet executed.
  5. 5. If you are using a boundary event, you cannot use certain activities. See Catch and Catch All Boundary Events and Compensate, Compensate Scope and Rethrow.
  6. 6. Fill in the properties for the activity to handle the fault.
To add the catch all handler for a scope:
  1. 1. Select a scope on the Process Activities tab of the Process Editor canvas.
  2. 2. Drag an Error catch event into the scope or near its border.
  3. 3. In the Properties view, select the Catch All Faults checkbox.
  4. 4. Drag an activity into the catch all handler, such as an assign or compensate.
  5. If you are using a boundary event, you cannot use certain activities. See Catch and Catch All Boundary Events and Compensate, Compensate Scope and Rethrow.
  6. 5. Fill in the properties for the activity to handle the fault.
The following illustration shows an example of Catch All fault handler added for a scope.
Tip: If you collapse the fault handler, you can add a background color from the Properties view. Right-mouse-click the handler and select Collapse Container.

Adding a Fault Handler as a Boundary Event for an Invoke Activity

When an invoke activity contains both an input and an output message, you can add a fault handler to catch any output message errors.
To add a fault handler to an invoke activity:
  1. 1. Display the Process Activities tab of the Process Editor canvas. You must be using the BPMN Process Editor in order to use boundary events.
  2. 2. Drag a Service task to the drawing canvas.
  3. 3. Add a fault handler (or event or compensation handler) to the border of the activity.
  4. 4. Follow the steps in Adding a Fault Handler for a Scope.

Selecting a Fault Name

Define a fault name based on a fault type and variable.
A catch or throw activity has a fault name property that you can open in Properties view. In the Fault Name dialog you can make the following selections:
The fault name is a required property of a throw activity and an optional property of a catch activity.

Adding a Fault Variable Definition

Select the variable definition, either message type or element. Then select a variable from the list.
Open the Fault Variable Definition dialog from the Properties view of a catch container.
  1. 1. Select Message Type for a list of all available messages.
  2. 2. Select Element if the message has a single part and that part is defined with an element type.
  3. 3. After you select a variable definition, return to the Properties view of the catch to type in a Variable name for the local catch variable.
After receiving an inbound fault message, the fault handler assigns the inbound fault message to the variable before proceeding to perform the activity enclosed by the catch. Since the variable is declared within a fault handler, it is not accessible outside of the fault handler much like a local variable is not accessible outside of its declaring scope.