[jdom-interest] newbie question: how to parse a soap message?
Charlie Wu
cwu at brocade.com
Tue Sep 17 13:40:34 PDT 2002
please disregard this question.. typos :-(
sorry for the spam
Charlie
-----Original Message-----
From: Charlie Wu [mailto:cwu at brocade.com]
Sent: Tuesday, September 17, 2002 1:28 PM
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] newbie question: how to parse a soap message?
Hi all:
I have been using JDOM for a while but quite new to namespaces.. can anyone
show me how to parse a SOAP message?
<SOAP-ENV:Envelope xmlns:e=" http://www.lexisnexis.com/xml/gw3_0/faults/
<http://www.lexisnexis.com/xml/gw3_0/faults/> " xmlns:m="
http://www.lexisnexis.com/xml/gw3_0/soap1_1/
<http://www.lexisnexis.com/xml/gw3_0/soap1_1/> " xmlns:xsd="
http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> " xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/
<http://schemas.xmlsoap.org/soap/encoding/> " xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> ">
<SOAP-ENV:Header>
<m:preferredTransportEndpoint>
https://cert-grp1.lexis-nexis.com/xml/gw3_0/soap1_1?wchp
<https://cert-grp1.lexis-nexis.com/xml/gw3_0/soap1_1?wchp>
=LdLzzb-tAAAA</m:preferredTransportEndpoint>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:AuthenticateResponse>
<m:authenticationToken>b972d119b5fb025b1de9ca31a9d8b9d6</m:authenticationTok
en>
<m:tokenExpiration>2002-09-18T15:32:16-04:00</m:tokenExpiration>
</m:AuthenticateResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I want to retrieve the authenticationToken.. and I tried:
StringReader sreader = new StringReader(sb.toString()); //sb
has the above XML document
Document doc = builder.build(sreader);
Namespace env_ns = Namespace.getNamespace("SOAP-ENV", "
http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> ");
Namespace m_ns = Namespace.getNamespace("m", "
http://www.lexisnexis.com/xml/gw3_0/soap1_1/
<http://www.lexisnexis.com/xml/gw3_0/soap1_1/> ");
Element root = doc.getRootElement();
String sid = root.getChild("Body",
env_ns).getChild("AuthencticateResponse",
m_ns).getChildText("AuthenticationToken", m_ns);
but I'm getting exceptions when I tried to parse it.. please help!
Thanks
Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020917/b3ff1fed/attachment.htm
More information about the jdom-interest
mailing list