parsing - Get the value from a SOAP message in Java -
i getting soap message string after making call web service.
<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <passoraclexmldataresponse xmlns="http://tempuri.org/"> <passoraclexmldataresult> <gesystem xmlns=""> <return_code>0</return_code> <message>prs user not exists in gets</message> <invoiceid>testaddtlinfo2</invoiceid> <datetime>apr 17 2013 4:19pm</datetime> </gesystem> </passoraclexmldataresult> </passoraclexmldataresponse> </soap:body> </soap:envelope>
i need retrieve values , elements. when tried use simple saxbuilder build document , traverse it, got exception after trying getchild on "soap: body"
getchild("soap:body") - returns null.
assuming you're using jdom:
soap:body 2 parts: namespace , element name. you'll want use namespace class include information when retrieving it.
try doing like:
envelopenode.getchild("body",envelopenode.getnamespace());
that'll make child element name "body", , same namespace envelope node.
Comments
Post a Comment