title: How to create custom soap fault message using spring web service
body: <p>I'm trying to write a web service using spring web service library. I'm able to configure my endpoints successfully and it is working fine, but I'm facing some issues with the exception mappings.</p>
  
  <p>I'm able to map exceptions using @SoapFault and SoapFaultAnnotationExceptionResolver but the wsdl definition is as follows</p>
  
  <pre><code>&lt;xsd:schema elementFormDefault="qualified" targetNamespace="http://abc.com/soap/"&gt;
      &lt;xsd:complexType name="ServiceException"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="message" nillable="true" type="xsd:string"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="ValidationException"&gt;
          &lt;xsd:complexContent&gt;
              &lt;xsd:extension base="tns:ServiceException"&gt;
                  &lt;xsd:sequence/&gt;
              &lt;/xsd:extension&gt;
          &lt;/xsd:complexContent&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="InternalException"&gt;
          &lt;xsd:complexContent&gt;
              &lt;xsd:extension base="tns:ServiceException"&gt;
                  &lt;xsd:sequence/&gt;
              &lt;/xsd:extension&gt;
          &lt;/xsd:complexContent&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="AuthenticationException"&gt;
          &lt;xsd:complexContent&gt;
              &lt;xsd:extension base="tns:ServiceException"&gt;
                  &lt;xsd:sequence/&gt;
              &lt;/xsd:extension&gt;
          &lt;/xsd:complexContent&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="LoginInput"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element minOccurs="1" maxOccurs="1" name="UserName" nillable="false" type="xsd:string"/&gt;
              &lt;xsd:element minOccurs="1" maxOccurs="1" name="PassWord" nillable="false" type="xsd:string"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="LoginOutput"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element minOccurs="1" maxOccurs="1" name="ValidTo" nillable="false" type="xsd:dateTime"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:element name="login" type="tns:LoginInput"/&gt;
      &lt;xsd:element name="loginResponse" type="tns:LoginOutput"/&gt;
  
      &lt;xsd:element name="ValidationException" type="tns:ValidationException"/&gt;
      &lt;xsd:element name="InternalException" type="tns:InternalException"/&gt;
      &lt;xsd:element name="AuthenticationException" type="tns:AuthenticationException"/&gt;
  &lt;/xsd:schema&gt;
  
  &lt;message name="LoginRequest"&gt;
      &lt;part name="login" element="tns:login"/&gt;
  &lt;/message&gt;
  
  &lt;message name="LoginResponse"&gt;
      &lt;part name="loginResponse" element="tns:loginResponse"/&gt;
  &lt;/message&gt;
  
  &lt;message name="ValidationException"&gt;
      &lt;part name="ValidationException" element="tns:ValidationException"/&gt;
  &lt;/message&gt;
  
  &lt;message name="InternalException"&gt;
      &lt;part name="InternalException" element="tns:InternalException"/&gt;
  &lt;/message&gt;
  
  &lt;message name="AuthenticationException"&gt;
      &lt;part name="AuthenticationException" element="tns:AuthenticationException"/&gt;
  &lt;/message&gt;
  
  &lt;portType name="ServicePortType"&gt;
      &lt;operation name="Login"&gt;
          &lt;input message="tns:LoginRequest"/&gt;
          &lt;output message="tns:LoginResponse"/&gt;
          &lt;fault name="ValidationException" message="tns:ValidationException"/&gt;
          &lt;fault name="InternalException" message="tns:InternalException"/&gt;
          &lt;fault name="AuthenticationException" message="tns:AuthenticationException"/&gt;
      &lt;/operation&gt;
  &lt;/portType&gt;
  
  &lt;binding name="ServiceBinding" type="tns:ServicePortType"&gt;
      &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
      &lt;operation name="Login"&gt;
          &lt;soap:operation soapAction="urn://Service#Login"/&gt;
          &lt;input&gt;
              &lt;soap:body use="literal"/&gt;
          &lt;/input&gt;
          &lt;output&gt;
              &lt;soap:body use="literal"/&gt;
          &lt;/output&gt;
          &lt;fault name="ValidationException"&gt;
              &lt;soap:fault name="ValidationException" use="literal"/&gt;
          &lt;/fault&gt;
          &lt;fault name="InternalException"&gt;
              &lt;soap:fault name="InternalException" use="literal"/&gt;
          &lt;/fault&gt;
          &lt;fault name="AuthenticationException"&gt;
              &lt;soap:fault name="AuthenticationException" use="literal"/&gt;
          &lt;/fault&gt;
      &lt;/operation&gt;
  &lt;/binding&gt;
  </code></pre>
  
  <p>How can I write a exception handling for this service definition?</p>
  
  <p>Thank you</p>