Hello
I'm using Axis client 1.2 and trying to catch custom soap fault
defined in wsdl. SOAP service is not Axis-driven one but i can control it .
It seems WSDL2Java properly creates an exception class and
inherit it from org.apache.axis.AxisFault. But caught exception object
is AxisFault and property 'detail' is null instead of MyException
object. AxisFault.getFaultDetails() contains DOM tree of
<detail> tag but custom exception object is not
mapped to tag.
Here is relevant part of wsdl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="myservice"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="MyModule"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="MyModule">
...
...
<wsdl:types>
<xsd:schema targetNamespace="myModule"
.......................
<xsd:complexType name="MyException">
<xsd:sequence>
<xsd:element name="MyException" minOccurs="1"
maxOccurs="1" type="tns:Error_list"/>
</xsd:sequence>
</xsd:complexType>
..........
...........
<wsdl:message name="faultMsg">
<wsdl:part type="tns:MyException" name="faultPart"/>
</wsdl:message>
<wsdl:portType name="myPort">
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest"/>
<wsdl:output message="tns:loginResponse"/>
<wsdl:fault message="tns:faultMsg" name="faultOp"/>
</wsdl:operation>
................
...................
<wsdl:binding name="myBinding" type="tns:myPort">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="login">
<soap:operation soapAction="MyModule#login"/>
<wsdl:input>
<soap:body namespace="MyModule" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body namespace="MyModule" use="literal"/>
</wsdl:output>
<wsdl:fault name="faultOp">
<soap:fault name="faultOp" namespace="MyModule" use="literal"/>
</wsdl:fault>
</wsdl:operation>
Here is what Axis client gets from server:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:MyModule</faultcode>
<faultstring>Login test error</faultstring>
<detail>
<e:MyException xmlns:e="MyModule">
<e:error>
<e:code xsi:type="xsd:int">1</e:code>
<e:text xsi:type="xsd:string">Login or password are
invalid</e:text>
</e:error>
</e:MyException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Adding <axis:exceptionName ....>MyModule.MyException</axis:exceptionName>to
soap fault causes myException to throw on client side
but it is not mapped anyway.
Please answer: Is it something wrong in wsdl or envelop or both?