You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Scott Nichol <sn...@scottnichol.com> on 2003/01/16 17:00:04 UTC
Re: Handling faults on the client side ( and Root element of a SOAP
message must be: 'http://schemas.xmlsoap.org/soap/envelope/
You are getting the error because you have not made your document
builder namespace aware. When you create a document builder, you may
want to use org.apache.soap.util.xml.XMLParserUtils#getXMLDocBuilder.
This method will always return a document builder that is namespace
aware.
On 16 Jan 2003 at 13:30, Jesus M. Salvo Jr. wrote:
>
> 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: <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>
Scott Nichol
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>