title: JAX-WS spring server-side set custom fault message for RuntimeExceptions
body: <h1>Problem</h1>
  
  <p>By default, JAX-WS builds the following SOAP fault message when an uncaught exception that extends <code>RuntimeException</code> occurs on my server:</p>
  
  <pre><code>&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;S:Body&gt;
        &lt;S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"&gt;
           &lt;faultcode&gt;S:Server&lt;/faultcode&gt;
           &lt;faultstring&gt;[runtime exception message here]&lt;/faultstring&gt;
           &lt;detail&gt;
              &lt;ns2:exception class="java.lang.RuntimeException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" xmlns:ns2="http://jax-ws.dev.java.net/"&gt;
                 &lt;message&gt;[runtime exception message here too]&lt;/message&gt;
                 &lt;ns2:stackTrace&gt;
                    [stack trace details]
                 &lt;/ns2:stackTrace&gt;
              &lt;/ns2:exception&gt;
           &lt;/detail&gt;
        &lt;/S:Fault&gt;
     &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>Which kind of make sense, except that I'd like to change that behavior in order to send that instead:</p>
  
  <pre><code>&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;S:Body&gt;
        &lt;S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"&gt;
           &lt;faultcode&gt;S:Server&lt;/faultcode&gt;
           &lt;faultstring&gt;Something wrong happened and it's totally our fault&lt;/faultstring&gt;
        &lt;/S:Fault&gt;
     &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>Note that the message should <strong>NOT</strong> be the RuntimeException's message content, but a custom <strong>static message</strong> for <strong>any</strong> exception that extends <code>RuntimeException</code> that may occur server-side.</p>
  
  <p>I can't change the WSDL and I don't want to set a custom exception.</p>
  
  <p>I'm using the spring plugin: <code>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</code></p>
  
  <p>How can I do that?</p>