Hi all,
I´ve a problem sending back a fault message from a service.
This is the main information about the messages and operation defined on my WSDL:
When from the service I send a EchoResponse there is not problem, the SOAP is well formed and sended, but when I send a EchoException it´s not sended.Code:<xs:element name="EchoRequest"> <xs:complexType> <xs:all> <xs:element name="Echo" type="ec:EchoType"/> </xs:all> </xs:complexType> </xs:element> <xs:element name="EchoResponse"> <xs:complexType> <xs:all> <xs:element name="Echo" type="ec:ReturnType"/> </xs:all> </xs:complexType> </xs:element> <xs:element name="EchoException"> <xs:complexType> <xs:all> <xs:element name="Error" type="ec:ExceptionType"/> </xs:all> </xs:complexType> </xs:element> <xs:complexType name="ExceptionType"> <xs:sequence> <xs:element name="ErrorDescription" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="EchoType"> <xs:sequence> <xs:element name="Name" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="ReturnType"> <xs:sequence> <xs:element name="Message" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="EchoResponse"> <wsdl:part element="tns:EchoResponse" name="EchoResponse"> </wsdl:part> </wsdl:message> <wsdl:message name="EchoRequest"> <wsdl:part element="tns:EchoRequest" name="EchoRequest"> </wsdl:part> </wsdl:message> <wsdl:message name="EchoException"> <wsdl:part element="tns:EchoException" name="EchoException"> </wsdl:part> </wsdl:message> <wsdl:portType name="Echo"> <wsdl:operation name="Echo"> <wsdl:input message="tns:EchoRequest" name="EchoRequest"> </wsdl:input> <wsdl:output message="tns:EchoResponse" name="EchoResponse"> </wsdl:output> <wsdl:fault message="tns:EchoException" name="EchoException"> </wsdl:fault> </wsdl:operation> </wsdl:portType>
Code:public void postProcessInputMessage(IResponse response) { System.out.println("[EchoEndPoint].[postProcessInputMessage]: init"); if(response instanceof WebServiceIllegalArgumentException) { EchoException exception = new EchoException(); ExceptionType exType = new ExceptionType(); exType.setErrorDescription(((WebServiceIllegalArgumentException)response).getErrorCode() + ": " + ((WebServiceIllegalArgumentException)response).getErrorDescription()); //exception.setErrorCode(((WebServiceIllegalArgumentException)response).getErrorCode() + ":" + ((WebServiceIllegalArgumentException)response).getErrorDescription()); exception.setError(exType); setWebServiceResponse(exception); } else { EchoResponse err = new EchoResponse(); ReturnType rt = new ReturnType(); rt.setMessage(((EchoResponseModel) response).getEchoResponseString()); err.setEcho(rt); setWebServiceResponse(err); } System.out.println("[EchoEndPoint].[postProcessInputMessage]: end"); }
My marshalling/unmarshalling configuration on client/server is:
What´s wrong? Anyone had have the same problem?Code:<bean id="marshallerWS" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="mtomEnabled" value="false"/> <property name="classesToBeBound"> <list> <value>es.gni.test.echojaxb2.EchoRequest</value> <value>es.gni.test.echojaxb2.EchoResponse</value> <value>es.gni.test.echojaxb2.EchoException</value> <value>es.gni.test.echojaxb2.ExceptionType</value> </list> </property> </bean>
Thanks in advance for you time and best regards,
Sergio Arcos Hurtado


Reply With Quote
... receiving the message in the client through an SoapFaultClientException.