title: How to unmarshal a SOAP Fault in a FaultMessageResolver?
body: <p>I'm new to Spring-WS, and slowly getting my head wrapped around it.  Right now, I'm writing a simple client to communicate with an existing WS.  I'm using the WebServiceTemplate and the marshalSendAndReceive method.  Everything works fine.</p>
  
  <p>However, when a SOAP fault occurs, the WST throws a SoapFaultClientException.  I noticed that I can create my own FaultMessageResolver to check what is contained within the SOAP fault.  However, when I try to unmarshal the WebServiceMessage in my FaultMessageResolver, I get the following error message:</p>
  
  <pre><code>JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Fault"). Expected elements are ....
  </code></pre>
  
  <p>Obviously, my unmarshaller is not properly configured.  Do I have to generate the JAXB fault model myself using xjc to then be able to unmarshal the error?  I am somewhat amazed that this does not already exist.</p>
  
  <p>Is there a better way to extra my custom error information from within my soap:fault response?  My error looks something like the following and I am trying to extract/access the serviceErrors item.</p>
  
  <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;Blaze Data Error&lt;/faultstring&gt;
           &lt;detail&gt;
              &lt;ns14:serviceErrors xmlns="http://www.nb.com/ClientServices/LendingSimulation/CalculateProfitabilityRequest" xmlns:ns13="http://www.nb.com/fw/errorMgmt" xmlns:ns14="http://www.nb.com/ClientServices/LendingSimulation/V1" &gt;
                 &lt;ns13:faultstring&gt;ServiceExecutionError&lt;/ns13:faultstring&gt;
                 &lt;ns13:serviceError&gt;
                    &lt;ns13:errorCode&gt;C10F1013&lt;/ns13:errorCode&gt;
                    &lt;ns13:errorType&gt;B&lt;/ns13:errorType&gt;
                    &lt;ns13:errorMessage&gt;Unable to retreive additional data&lt;/ns13:errorMessage&gt;
                    &lt;ns13:fieldName&gt;Message error received from PHClient :  [An unexpected error code was received : system=PH context=[empty]]&lt;/ns13:fieldName&gt;
                    &lt;ns13:systemId&gt;Calculator&lt;/ns13:systemId&gt;
                    &lt;ns13:time&gt;2012-06-19 14:45:10.151-0400&lt;/ns13:time&gt;
                 &lt;/ns13:serviceError&gt;
              &lt;/ns14:serviceErrors&gt;
           &lt;/detail&gt;
        &lt;/soap:Fault&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Eric</p>