0
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Head>
      <h:talkId s:mustknow="1" xmlns:h="urn:schemas-test:testgate:hotel:2012-06">sfasfasfasfsfsf/h:talkidId>
   </s:Head>
   <s:Body>
      <bookHotelResponse xmlns="urn:schemas-test:testgate:hotel:2012-06" xmlns:d="http://someURL" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

         <d:bookingReference>123456</d:bookingReference>
         <d:bookingStatus>successful</d:bookingStatus>
         <d:price xmlns:d="moreURL">
            <b:total>105</b:total>
         </d:price>
      </bookHotelResponse>
   </s:Body>
</s:Envelope>

want to read the bookingStatus and total from the soap message above using xmldocument and xpath but does not work i am using the code below

            XmlDocument document = new XmlDocument();
            document.LoadXml(soapmessage);  //loading soap message as string
            XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable);

            manager.AddNamespace("d", "http://someURL");

            XmlNodeList xnList = document.SelectNodes("//bookHotelResponse", manager);
            int nodes = xnList.Count;

            foreach (XmlNode xn in xnList)
            {
                Status = xn["d:bookingStatus"].InnerText;
            }
3
Contributors
2
Replies
6
Views
5 Years
Discussion Span
Last Post by geniusvishal
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.