<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>newbie question: how to parse a soap message?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Arial">Hi all:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I have been using JDOM for a while but quite new to namespaces.. can anyone show me how to parse a SOAP message?</FONT>
</P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Envelope</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:e</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.lexisnexis.com/xml/gw3_0/faults/" TARGET="_blank">http://www.lexisnexis.com/xml/gw3_0/faults/</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:m</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.lexisnexis.com/xml/gw3_0/soap1_1/" TARGET="_blank">http://www.lexisnexis.com/xml/gw3_0/soap1_1/</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:xsd</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.w3.org/2001/XMLSchema" TARGET="_blank">http://www.w3.org/2001/XMLSchema</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:xsi</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.w3.org/2001/XMLSchema-instance" TARGET="_blank">http://www.w3.org/2001/XMLSchema-instance</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:SOAP-ENC</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://schemas.xmlsoap.org/soap/encoding/" TARGET="_blank">http://schemas.xmlsoap.org/soap/encoding/</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:SOAP-ENV</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=&quot;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://schemas.xmlsoap.org/soap/envelope/" TARGET="_blank">http://schemas.xmlsoap.org/soap/envelope/</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&quot;&gt;</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Header</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:preferredTransportEndpoint</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="https://cert-grp1.lexis-nexis.com/xml/gw3_0/soap1_1?wchp" TARGET="_blank">https://cert-grp1.lexis-nexis.com/xml/gw3_0/soap1_1?wchp</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">=</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">LdLzzb-tAAAA</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:preferredTransportEndpoint</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Header</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Body</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:AuthenticateResponse</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:authenticationToken</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">b972d119b5fb025b1de9ca31a9d8b9d6</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:authenticationToken</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:tokenExpiration</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">2002-09-18T15:32:16-04:00</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:tokenExpiration</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">m:AuthenticateResponse</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Body</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&lt;/</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">SOAP-ENV:Envelope</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I want to retrieve the authenticationToken.. and I tried:</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">StringReader sreader = new StringReader(sb.toString()); //sb has the above XML document</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">Document doc = builder.build(sreader);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">Namespace env_ns = Namespace.getNamespace(&quot;SOAP-ENV&quot;, &quot;<A HREF="http://schemas.xmlsoap.org/soap/envelope/" TARGET="_blank">http://schemas.xmlsoap.org/soap/envelope/</A>&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">Namespace m_ns = Namespace.getNamespace(&quot;m&quot;, &quot;<A HREF="http://www.lexisnexis.com/xml/gw3_0/soap1_1/" TARGET="_blank">http://www.lexisnexis.com/xml/gw3_0/soap1_1/</A>&quot;);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">Element root = doc.getRootElement();</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">String sid = root.getChild(&quot;Body&quot;, env_ns).getChild(&quot;AuthencticateResponse&quot;, m_ns).getChildText(&quot;AuthenticationToken&quot;, m_ns);</FONT></P>

<P><FONT SIZE=2 FACE="Arial">but I'm getting exceptions when I tried to parse it.. please help!</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thanks</FONT>
<BR>
<BR><FONT SIZE=2 FACE="Arial">Charlie</FONT>
</P>

</BODY>
</HTML>