This documentation is for WSO2 ESB version 4.5.1. View documentation for the latest release.

Fault Mediator

The Fault Mediator transforms the current message into a fault message, but does NOT send it. The Send Mediator needs to be invoked to send a fault message created this way. The fault message's To header is set to the Fault-To of the original message if such a header exists in the original message. If a version attribute is specified, the created fault message will be created as a selected SOAP 1.1, SOAP 1.2 or POX fault.



Syntax

<makefault [version="soap11|soap12|pox"]>
   <code (value="literal" | expression="xpath")/>
   <reason (value="literal" | expression="xpath")>
   <node>?
   <role>?
   <detail>?
</makefault>

UI Configuration

Two versions can be chosen for the Fault Mediator:

Version SOAP 1.1

For this version, the following options are available:

  • Fault Code
    • versionMismatch - SOAP version mismatch error.
    • mustUnderstand - SOAP error regarding "must understand" error.
    • Client - Client side error.
    • Server - Server side error.
  • Value/Expression
  • Fault String - The detailed fault string of the fault code. It can be given either as a string value or an expression.

    Tip

    You can click on this link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor," where you can provide any number of namespace prefixes and URL that you have used in the XPath expression.

  • Fault Actor
  • Detail - Some information about the fault can be added to this field.
Version SOAP 1.2

For this version, the following options are available:

  • Code
    • versionMismatch - SOAP version mismatch error.
    • mustUnderstand - SOAP error regarding "must understand" error.
    • dataEncodingUnknown - SOAP encoding error.
    • Sender - Sender-side error.
    • Receiver - Receiver-side error.
  • Value/Expression
  • Reason - Reason describing the fault code.

    Tip

    You can click on the "Namespaces" link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor," where you can provide any number of namespace prefixes and URL that you have used in the XPath expression.

  • Role - SOAP 1.2 role names.
  • Node - SOAP 1.2 node name.
  • Detail - Some information about the fault can be added to the field.

Note

You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.


Example

<makefault xmlns="http://ws.apache.org/ns/synapse" version="soap11">
   <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch" />
   <reason value="test message " />
   <role></role>
</makefault>