System faults can be handle by setting an exception object by invoking following api:
javax.jbi.messaging.MessageExchange public void setError(java.lang.Exception error)
The getMessage() method on java.lang.Exception will return an xml instance document which confirm to following xsd:
The schema describe a SystemFault element which has version attribute and following child elements:
The version attribute allow us to evolve the structure of the System Faults.
The description of these elements is shown in the xsd documentation.
Following is a snippet of SystemFault from the schema:
<xsd:element name="SystemFault" type="tns:SystemFaultType"/$gt;
<xsd:complexType name="SystemFaultType" final="extension">
<xsd:sequence>
<xsd:element name="code" type="tns:CodeType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
This would be specify either sender/receiver.
sender indicates that component who is setting this error wants to convey that error is due to something wrong at
the sender of a message exchange.Example sender has sent wrong message.
receiver indicates that component who is setting this error wants to convey that error is due to something wrong at
this component of a message exchange. Example: receiver can not process message due to some internal error.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="subcode" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>This would be specify system fault identifer string. Example: "Timed Out" for s time out system fault.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="reason" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>This would human readable description of system fault. Example:This task is not complete within 2 days and timed out</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="node" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Which component caused the error. This could be an intermediary component.
A node (component) is identified by a URI.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="role" type="tns:RoleType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>This is optional. identifies the role the node was operating in at the point the fault occurred.
Valid values are:
next
none
ultimateReceiver
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="detail" type="tns:DetailType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>This would be extra details if any for a fault.</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:string" >
<xsd:annotation>
<xsd:documentation>Version is helpful in evolution of the structure of the system faults. If there is a change in system fault, it will have a new version.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
Task Timeout and System Fault:
On Task Timeout WLMSE will set Error on message exchange by creating an java.lang.Exception object which returns following xml instance document when getMessage() is called.
<SystemFault version="1.0" xmlns="http://java.sun.com/xml/ns/jbi/systemfaults" >
<code>receiver</code>
<subcode>Timed Out</subcode>
<reason>This task is not completed within specified time and timed out </reason>
</SystemFault>
BPEL SE when receive the Error Exception in the message exchange, can optmize to check if the getMessage starts with <SystemFault is so it can then process the System Fault.
Mapping of System Fault to WSDL Message:
Following is the well known WSDL Message which maps the System Fault to a WSDL Message:
Following is the snippet of WSDL Message:
<message name="SystemFaultMessage">
<wsdl:part name="systemFaultPart" element="ns0:SystemFault"/>
</message>
upon receiving System Fault BPEL SE can map it to SystemFaultMessage. User can use SystemFaultMessage to catch this specific message and deal it appropriately.