.net - C# XPath Soap, how to navigate to embedded node -


in c#, asp.net, trying return error node inside of bisearchresponse: able getwireresult node returned in xmlnode. how error node?

<?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> -          <getwireresponse xmlns="http://opensolutions.com/">                 <getwireresult><?xml version="1.0"?>                        <bisearchresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">                              <error xmlns="https://bixg.choicepoint.com/webservices/3.0">                                     <message>bi system: failed login</message>                                     <code>536870917</code>                              </error>                       </bisearchresponse>                   </getwireresult>              </getwireresponse>        </soap:body>   </soap:envelope> 

my code: xmldocument xmldoc = new xmldocument();

            xmldoc.loadxml(result);              xmlnamespacemanager nsmgr = new xmlnamespacemanager(xmldoc.nametable);             nsmgr.addnamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");             nsmgr.addnamespace("ab", "http://opensolutions.com/");             nsmgr.addnamespace("bg", " https://bixg.choicepoint.com/webservices/3.0");             nsmgr.addnamespace("xsd", "http://www.w3.org/2001/xmlschema");             nsmgr.addnamespace("xsi", "http://www.w3.org/2001/xmlschema-instance");              xmlnode xmlnode = xmldoc.documentelement.selectsinglenode("/soap:envelope/soap:body/ab:getwireresponse", nsmgr); 

this works here. . adding xml here, visible in edit mode.

<?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> - <getwireresponse xmlns="http://opensolutions.com/">   <getwireresult><?xml version="1.0"?> <bisearchresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <error xmlns="https://bixg.choicepoint.com/webservices/3.0"> <message>bi system: failed login</message> <code>536870917</code> </error> </bisearchresponse></getwireresult>    </getwireresponse>   </soap:body>   </soap:envelope> 

in debug mode, when copy xml, try choose debug visualizer, e.g. "text visualizer". can select clicking magnifying glass icon in datatip.

i think xml looks like:

<?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>     <getwireresponse xmlns="http://opensolutions.com/">       <getwireresult>         &lt;?xml version="1.0"?&gt;         &lt;bisearchresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"&gt;         &lt;error xmlns="https://bixg.choicepoint.com/webservices/3.0">         &lt;message>bi system: failed login&lt;/message&gt;         &lt;code>536870917&lt;/code&gt;         &lt;/error&gt;         &lt;/bisearchresponse&gt;       </getwireresult>     </getwireresponse>   </soap:body> </soap:envelope> 

or

<?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>     <getwireresponse xmlns="http://opensolutions.com/">       <getwireresult>         <![cdata[         <?xml version="1.0"?>         <bisearchresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">           <error xmlns="https://bixg.choicepoint.com/webservices/3.0">             <message>bi system: failed login</message>             <code>536870917</code>           </error>         </bisearchresponse>         ]]>       </getwireresult>     </getwireresponse>   </soap:body> </soap:envelope> 

no matter. can select getwireresult using following xpath:

/soap:envelope/soap:body/ab:getwireresponse/ab:getwireresult 

and load content in new xml document , desired response.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -