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:
- Create the new type as follows:
- Create a new library called FaultType by
clicking .
- Right-click your process module and select Open Dependency
Editor. Click Add and select FaultType from
the list.
- Create an XSD file called bpcfault.xsd by
clicking .
- 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>
- Create a variable and point to the XSD file.
- In the tray, create a new variable by clicking the plus symbol
(
) beside the
Variables area.
- In the properties area, click the Details tab.
- Select Data Type, and click Browse.
- In the Data Type Selection window, click Show all
XSD types, browse to StandardFaultType,
and click OK..
- 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.