java - XPathExpressionException on xpath -
i'm tring data these xml :
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.alternative.thy.com/" xmlns:req="http://www.thy.com/ws/requestheader" xmlns:ns="http://www.opentravel.org/ota/2003/05"> <soapenv:header/> <soapenv:body> <ser:gs> <!--optional:--> <requestheader> <!--optional:--> <req:clientcode>kl7mu</req:clientcode> <!--optional:--> <req:clientusername>blabla</req:clientusername> </requestheader> </ser:gs> </soapenv:body>
to clientusername write
soapmessage message = context.getmessage(); outputstream os = new bytearrayoutputstream(); message.writeto(os); string xpath = "////requestheader/req:clientusername"; xpath xpath = xpathfactory.newinstance().newxpath(); string sad = xpath.evaluate(xpath, new inputsource( new stringreader(os.tostring())));
but returns :javax.xml.xpath.xpathexpressionexception. think fail reson xpath statement ////requestheader/req:clientusername correct statement?
try :
soapenv//ser:gs//requestheader//req:clientusername
Comments
Post a Comment