title: When mule-soap exception occurred, how do I send my own fault code and fault string rather than generic soap fault message?
body: <p>I am making SOAP call from Mule. I am using default-exception-strategy for catching exception. 
  When exception occurred, how do I send my own fault code and fault string rather than generic soap fault message? Thanks</p>
  
  <p>Here is the snippet of mule xml, java code, actual output and expected output</p>
  
  <h1>Mule xml</h1>
  
  <pre><code>&lt;flow name="addressSearchFlow1" doc:name="addressSearchFlow1"&gt;
      &lt;invoke object-ref="InvoiceManager" method="completeSearchObject"
          methodArguments="#[message.payload]"&gt;&lt;/invoke&gt;
  
      &lt;logger level="INFO" doc:name="Logger" /&gt;
  
      &lt;processor-chain doc:name="Search Processor Chain"&gt;
          &lt;cxf:jaxws-client operation="doSearch"
              clientClass="com.invoice.web_2007_09.ProWeb" port="InvoicePortType"
              wsdlLocation="proweb.wsdl" enableMuleSoapHeaders="true" doc:name="SOAP"&gt;
          &lt;/cxf:jaxws-client&gt;
          &lt;http:outbound-endpoint exchange-pattern="request-response"
              method="POST" ref="InvoiceEndPoint" doc:name="HTTP" /&gt;
      &lt;/processor-chain&gt;
  
      &lt;default-exception-strategy&gt;
          &lt;processor-chain&gt;
              &lt;logger message="Exception_logger" level="INFO" doc:name="Exception_logger" /&gt;
              &lt;custom-transformer class="com.managers.CustomExceptionHandler" /&gt;
              &lt;logger message="Exception_logger" level="INFO" doc:name="Exception_logger" /&gt;
          &lt;/processor-chain&gt;
      &lt;/default-exception-strategy&gt;
  
  &lt;/flow&gt;
  </code></pre>
  
  <h1>Java code</h1>
  
  <pre><code>package com.managers;
  
  import org.mule.api.MuleMessage;
  import org.mule.api.transformer.TransformerException;
  import org.mule.message.ExceptionMessage;
  import org.mule.transformer.AbstractMessageTransformer;
  
  public class CustomExceptionHandler extends AbstractMessageTransformer {
  
  public CustomExceptionHandler() {
      setName("CustomExceptionHandler");
  }
  
  @Override
  public Object transformMessage(MuleMessage message, String outputEncoding)
          throws TransformerException {
  
      ExceptionMessage exceptionMessage = (ExceptionMessage)message.getPayload();
  
      String outputMessage = "&lt;soap:Fault xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;        "
              + " &lt;faultcode&gt;soap:Server&lt;/faultcode&gt; "
              + "&lt;faultstring&gt;"
              + "An unexpected error has occured. Please contact your service desk and quote this error \""  + exceptionMessage.getException() +  "\""+ "&lt;/faultstring&gt;      " + "&lt;/soap:Fault&gt;";
      return outputMessage;
  
  }
  
  }
  </code></pre>
  
  <h2>Actual output</h2>
  
  <hr>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soap:Body&gt;
        &lt;soap:Fault&gt;
           &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
           &lt;faultstring&gt; dt-invoice. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod&lt;/faultstring&gt;
        &lt;/soap:Fault&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <h2>Expected output</h2>
  
  <hr>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soap:Body&gt;
        &lt;soap:Fault&gt;
           &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
           &lt;faultstring&gt; An unexpected error has occured. Please contact your service desk and quote this error   "org.mule.api.transport.DispatchException: dt-invoice. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PostMethod"
  &lt;/faultstring&gt;
        &lt;/soap:Fault&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>