title: JAX-WS Soap Faults not appearing in WSDL
body: <p>I am creating a web service using JAX-WS (I am creating this using the Java to WSDL approach).</p>
  
  <p>Im having trouble getting my exception to work as I require.</p>
  
  <p>I have created the following exception class:</p>
  
  <pre><code>@WebFault
  public class MyWebServiceException extends SOAPFaultException {
  
      private static final long serialVersionUID = 8234753208722614057L;
  
      protected MyWebServiceException(SOAPFault fault) {
          super(fault); 
      }
  
      protected MyWebServiceException(SOAPFault fault, Throwable throwable) {
          this(fault);
          super.setStackTrace(throwable.getStackTrace());
      }
  }
  </code></pre>
  
  <p>This allows me to have the following in my SOAP response:</p>
  
  <pre><code>&lt;faultcode&gt;E0010&lt;/faultcode&gt;
  &lt;faultstring&gt;Invalid Report&lt;/faultstring&gt;
  &lt;detail&gt;
      &lt;ns2:exception class="com.example.web.common.exceptions.MyWebServiceException" 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;Invalid Report&lt;/message&gt;
       &lt;ns2:stackTrace&gt;
       &lt;ns2:frame class="com.example.web.common.exceptions.ExceptionHandler" file="ExceptionHandler.java" line="34" method="getWebException"/&gt;
  </code></pre>
  
  <p>However, because my exception is a <code>SOAPFaultException</code> which extends <code>RuntimeException</code>, it is not being added to the WSDL, so when users of the service generate their client stubs the exception is not included.</p>
  
  <p>Does anyone know how to create this exception to give me the intended output (ie including the faultcode and faultstring) but also appear in the WSDL (I  guess it needs to be a checked exception)</p>
  
  <p>I searched SO high and low to come up with what I have already!</p>