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:
  1. Create the new type as follows:
    1. 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 FaultType from 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"?>
      
      <!--
      (C) Copyright IBM Corporation 2005.
      
      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 (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 fault activity that you would like to associate with the new fault type. In the Details tab, browse to the newly create fault variable.
Note: 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.
Related concepts
Best Practice: Choosing the appropriate compensation for your process
Related tasks
Using a fault handler
Compensating activities in a long-running process
Compensating a microflow

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.