The following is another way to parse the response:
msg.send(url, "", envelope);
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
String s = Call.getEnvelopeString(msg.getSOAPTransport());
Document doc = xdb.parse(new InputSource(new StringReader(s)));
Node node = doc.getElementsByTagName("Code").item(0);
String code = node.getFirstChild().getNodeValue();
if (code.equals("0"))
// response OK!
> -----Original Message-----
> From: Scott Nichol [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 10, 2004 9:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: How to parse SOAP response?
>
>
> Basically, you need to do what Call#invoke does after the st.send() call.
> You will need to create a SOAPMappingRegistry instance as part of
> this, and
> initialize it for any types beyond those implicitly supported
> (which is the
> same as RPC API users already do).
>
> Scott Nichol
>
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message -----
> From: "T.J. Hoo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 10, 2004 4:18 AM
> Subject: How to parse SOAP response?
>
>
> Hi!
>
> I'm writing a standalone client to construct and send a SOAP message to a
> server.
> The response received from the server looks like the following:
>
> HTTP/1./1 200 OK
> ...
> <env:Envelope...>
> ...
> <env:Body>
> <Response>
> <Status>
> <Code>0</Code>
> </Status>
> </Response>
> </env:Body>
> </env:Envelope>
>
>
> and currently, the program parses the response like the following:
>
> SOAPTransport st = msg.getSOAPTransport ();
> BufferedReader br = st.receive ();
> String line;
> while ((line = br.readLine ()) != null) {
> if (line.indexOf("<Code>0</Code") >= 0)
> return true;
> }
> return false;
>
>
> the above code looks ugly and gross, and I want to know how to convert the
> SOAP response into a XML document/Envelope object so that I'm
> able to lookup
> the XML element value easily. Is this possible?
>
>
> Disclaimer: This message and any attachments thereto are intended
> solely for
> the addressed recipient(s) and may contain confidential
> information. If you
> are not the intended recipient, please notify the sender by reply
> e-mail and
> delete the e-mail (including any attachments thereto) without producing,
> distributing or retaining any copies thereof. Any review, dissemination or
> other use of, or taking of any action in reliance upon, this
> information by
> persons or entities other than the intended recipient(s) is prohibited.
> Thank you.