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.
I'm able to map exceptions using @SoapFault and SoapFaultAnnotationExceptionResolver but the wsdl definition is as follows
<xsd:schema elementFormDefault="qualified" targetNamespace="http://abc.com/soap/">
<xsd:complexType name="ServiceException">
<xsd:sequence>
<xsd:element name="message" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ValidationException">
<xsd:complexContent>
<xsd:extension base="tns:ServiceException">
<xsd:sequence/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="InternalException">
<xsd:complexContent>
<xsd:extension base="tns:ServiceException">
<xsd:sequence/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="AuthenticationException">
<xsd:complexContent>
<xsd:extension base="tns:ServiceException">
<xsd:sequence/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LoginInput">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="UserName" nillable="false" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="PassWord" nillable="false" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LoginOutput">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="ValidTo" nillable="false" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="login" type="tns:LoginInput"/>
<xsd:element name="loginResponse" type="tns:LoginOutput"/>
<xsd:element name="ValidationException" type="tns:ValidationException"/>
<xsd:element name="InternalException" type="tns:InternalException"/>
<xsd:element name="AuthenticationException" type="tns:AuthenticationException"/>
</xsd:schema>
<message name="LoginRequest">
<part name="login" element="tns:login"/>
</message>
<message name="LoginResponse">
<part name="loginResponse" element="tns:loginResponse"/>
</message>
<message name="ValidationException">
<part name="ValidationException" element="tns:ValidationException"/>
</message>
<message name="InternalException">
<part name="InternalException" element="tns:InternalException"/>
</message>
<message name="AuthenticationException">
<part name="AuthenticationException" element="tns:AuthenticationException"/>
</message>
<portType name="ServicePortType">
<operation name="Login">
<input message="tns:LoginRequest"/>
<output message="tns:LoginResponse"/>
<fault name="ValidationException" message="tns:ValidationException"/>
<fault name="InternalException" message="tns:InternalException"/>
<fault name="AuthenticationException" message="tns:AuthenticationException"/>
</operation>
</portType>
<binding name="ServiceBinding" type="tns:ServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="urn://Service#Login"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="ValidationException">
<soap:fault name="ValidationException" use="literal"/>
</fault>
<fault name="InternalException">
<soap:fault name="InternalException" use="literal"/>
</fault>
<fault name="AuthenticationException">
<soap:fault name="AuthenticationException" use="literal"/>
</fault>
</operation>
</binding>
How can I write a exception handling for this service definition?
Thank you
After some more search I found this from spring source forum.
UPDATED
This a complete sample implementations I'm using,
I have successfully used SOAP Spring-WS to create a web service. Now I was doing the fault implementation in this SOAP service and I was able to do it with a class that I created like the following,
and inside the following overridden function,
Please this answer for the original solution.