title: Java - How to show Soap Fault
body: <p>I have this kind of response when having a Soap Fault calling a Java Web Service</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;Fault occurred while processing.&lt;/faultstring&gt;
              &lt;detail&gt;
                  &lt;ns1:WaybillRegistrationFault xmlns:ns1="http://pod.waybillmanagement.ws.industrysystem.com.ar/"&gt;
                      &lt;errors xmlns:ns2="http://pod.waybillmanagement.ws.industrysystem.com.ar/"&gt;
                          &lt;code&gt;80000&lt;/code&gt;
                          &lt;description&gt;El número de CTG 20140904 ya existe&lt;/description&gt;
                      &lt;/errors&gt;
                      &lt;errors xmlns:ns2="http://pod.waybillmanagement.ws.industrysystem.com.ar/"&gt;
                          &lt;code&gt;1000&lt;/code&gt;
                          &lt;description&gt;La carta de porte ya se encuentra registrada.&lt;/description&gt;
                      &lt;/errors&gt;
                  &lt;/ns1:WaybillRegistrationFault&gt;
              &lt;/detail&gt;
          &lt;/soap:Fault&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I did an Soap Handler with its handleFault method like this:
  public boolean handleFault(SOAPMessageContext context) {</p>
  
  <pre><code>    try {
          System.err.println("Handler handleFault");
  
          if (context.getMessage().getSOAPBody().hasFault()) {
              SOAPFault fa = context.getMessage().getSOAPBody().getFault();
              System.err.println(fa.getFaultString());
              System.err.println("FaultCode: " + fa.getFaultCode() + " - Detail: " + fa.getDetail());
          }
          return true;
      } catch (SOAPException ex) {
          System.err.println("SoapEx " + ex.getMessage());
          return true;
      }
  }
  </code></pre>
  
  <p>But in my output all I have is :</p>
  
  <pre><code>Handler handleFault
  Fault occurred while processing.
  FaultCode: soap:Server - Detail: [detail: null]
  </code></pre>
  
  <p>How do I process the errors node?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>with <code>fa.getDetail().getFirstChild().getTextContent()</code> I get the text within the xml. How do I get that as an object. It be a WaybillRegistrationFault I think.</p>