How are you supposed to handle faults on the client side, when receiving the HTTP response body from the SOAP Server?
For example, I have the piece of code below:
// Finally, send the SOAP envelope with attachment
this.logger.info( "Sending Submit SOAP message to " + p_postTo );
soapMessage.send( p_postTo, "", envelope );
this.logger.info( "Submit SOAP message sent" );
// Retrieve the response back
this.logger.debug( "Getting SubmitResponse...." );
SOAPTransport transport = soapMessage.getSOAPTransport();
BufferedReader reader = transport.receive();
// Get the SOAP envelope from the response
this.logger.debug( "Parsing SubmitResponse into a SOAP envelope..." );
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource source = new InputSource( reader );
Document xmlResponseDocument = builder.parse( source );
Envelope responseEnvelope = Envelope.unmarshall( xmlResponseDocument.getDocumentElement(), responseContext );
However, I am getting the following exception on the Envelope.unmarshall() call:
java.lang.IllegalArgumentException: Root element of a SOAP message must be: 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
Here is the full HTTP response from Apache-SOAP:
HTTP/1.1 500 Internal Server Error
Set-Cookie: JSESSIONID=CB8DCEFB04F423852D2B3281379A689D; Path=/soap
Content-Type: text/xml; charset=utf-8
Content-Length: 531
Date: Thu, 16 Jan 2003 02:14:54 GMT
Server: Apache Coyote/1.0
Connection: close
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>service 'http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0' unknown</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--
Jesus M. Salvo Jr.
Mobile Internet Group Pty Ltd
(formerly Softgame International Pty Ltd)
M: +61 409 126699
T: +61 2 94604777
F: +61 2 94603677
PGP Public key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC0BA5348
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
- Re: Handling faults on the client side ( and Root eleme... Jesus M. Salvo Jr.