Designer > Fault Handling > Catching Undeclared and SOAP Faults

Catching Undeclared and SOAP Faults

In standard fault handling, a fault message is declared as part of a WSDL operation. This declaration is a best practice and is expected behavior for BPEL fault handling. However, best practices do not always exist for Web services, and fault messages can be missing. When a service faults, the process faults with no information about the cause. To improve upon this behavior, Process Developer provides fault handling for undeclared faults.
To catch undeclared faults as well as SOAP faults, you can declare your own faults and then use the Process Developer fault custom functions to handle non-WSDL faults.
Using the Process Developer custom functions, you can prevent a process from terminating and can get access to the following fault information:
Here are some examples of how to create fault handling of undeclared faults.
Example 1: Add a CatchAll handler for undeclared faults and SOAP faults
  1. 1. Add a catchAll to a scope or to the process, as described in Defining Catch and CatchAll Fault Handlers. (Or add the handler as a BPMN boundary event).
  2. 2. Add an assign activity as the target activity of the handler.
  3. 3. Copy an expression to a process variable using the fault custom functions, as shown in the following example:
  4. 4. The copy operation you create would look like the following XQuery example:
  5. Copy From:
    <ns1:myFaultInfo xmlns:ns1="urn:faults:undeclared" xmlns:ns2="urn:faults:undeclared:result">
    <ns2:FaultString>{ abx:getFaultString() }</ns2:FaultString>
    <ns2:FaultDetail>{ abx:getFaultDetail() }</ns2:FaultDetail>
    <ns2:SOAPFault>{ abx:getSOAPFault() }</ns2:SOAPFault>
    Copy To:
Example 2: Declare a process variable to add to a catch
  1. 1. Add a schema element to a project WSDL. This is used in a catch or throw fault variable definition. For example:
  2. <xs:element name="undeclaredFaultElement" type="tns:undeclaredFaultType"/>
    <xs:complexType name="undeclaredFaultType">
    <xs:element name="faultMessage" type="xs:string" />
  3. 2. Add a catch and use the schema element as a Fault Variable Definition:
  4. Element = ns1:undeclaredFaultElement
  5. 3. Add a catch Fault Variable Name, such as myFault
  6. 4. Add an assign activity to the catch, and complete it as in Example 1.
Example 3: Declare a process variable to add to a throw activity
  1. 1. Add a schema element to a project WSDL, as in Example 2.
  2. 2. Add a new process variable, such as myFault, defined as the schema element.
  3. 3. Add an Initial Value to the variable as a literal, such as the following example:
  4. <ns1:undeclaredFaultElement xmlns:ns1="urn:faults:undeclared">
  5. 4. Add a throw to the process.
  6. 5. Select myFault as the Fault Variable.
  7. 6. Create a Custom Fault Name for the throw, such as ns1:myFault.
Example 4: Catch a Java fault by name
  1. 1. Add the required namespace to the process, as follows:
  2. aex=""
    This is the Process Developer namespace used for catching system errors.
  3. 2. Add a catch to the process.
  4. 3. Define a custom Fault Name as follows:
  5. 4. Complete the catch by adding an assign. See Example 1.
  6. 5. For example, if the is thrown by an invoke due to an invalid URL, the fault detail element will appear as follows:
  7. <ext:UnknownHostException xmlns:ext=""
    <Class xmlns=""></Class>
    <Message xmlns="">unknown-host</Message>
    <StackTrace xmlns=""> unknown-host