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

Typing fault variables

A fault variable stores data in the event of a standard or a system fault.

When a standard fault or runtime failure is caught by a fault handler, the message type must point to the StandardFaultType. To manually create a complex type called StandardFaultType, proceed as follows:


Procedure

  1. Create the new type as follows:

    1. If there is no existing library, create a new library called FaultType by clicking File > New > Other > Library.
    2. Right-click your process module and select Open Dependency Editor. Click Add and select the library from step 1a in the list.

    3. Create an XSD file called bpcfault.xsd by clicking File > New > Other > Simple > File.
    4. Paste the following text into the editor and save it.
      <?xml version="1.0"?>
      
      <!--
      
      This file specifies a complex data type that may be used in BPEL processes in fault handlers that catch a standard or runtime fault to specify the variable type.
      -->
      <xs:schema targetNamespace="http://www.ibm.com/xmlns/prod/websphere/business-process/6.0.0/"
                 xmlns:xs="http://www.w3.org/2001/XMLSchema"
                 elementFormDefault="qualified">
      
              <!--
              Standard fault type         -->
              <xs:complexType name="StandardFaultType">
                      <xs:sequence>
                              <xs:element name="faultName" type="xs:string"/>
                              <xs:element name="faultNameUri" type="xs:string"/>
                              <xs:element name="messageText" type="xs:string"/>
                              <xs:element name="rootException" type="xs:string"/>
                      </xs:sequence>
              </xs:complexType>
      
      </xs:schema>

  2. Create a variable and point to the XSD file.

    1. In the tray, create a new variable by clicking the plus symbol () beside the Variables area.

    2. In the properties area, click the Details tab.

    3. Select Data Type, and click Browse.

    4. In the Data Type Selection window, click Show all XSD types, browse to StandardFaultType, and click OK..
  3. Determine the catch element (that exists within a Fault Handler) that you would like to associate with the new fault type. In the Details tab, browse to the newly create fault variable.


Results

If you want to wrap a Java™ exception in a fault, keep the following in mind. If a process calls a service that in turn throws an exception, it will return a ServiceBusinessException. Since a ServiceBusinessException does not contain any information about the WSDL fault name, the process uses the associated data object to correlate with the faults defined on the WSDL operation to determine one. As a result, all ServiceBusinessExceptions must be constructed with a data object in order to resolve the fault name.

Adding a variable to a business state machine

Dealing with faults in your BPEL process


Related concepts:
Fault activities
Raising faults
BPEL process compensation


Related tasks:
Use fault handlers
Continue processing upon unhandled faults