title: Read Soap Message using C#
body: <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;s:Head&gt;
      &lt;h:talkId s:mustknow="1" xmlns:h="urn:schemas-test:testgate:hotel:2012-06"&gt;
        sfasfasfasfsfsf&lt;/h:talkId&gt;
      &lt;/s:Head&gt;
    &lt;s:Body&gt;
      &lt;bookHotelResponse xmlns="urn:schemas-test:testgate:hotel:2012-06" xmlns:d="http://someURL" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
        &lt;d:bookingReference&gt;123456&lt;/d:bookingReference&gt;
        &lt;d:bookingStatus&gt;successful&lt;/d:bookingStatus&gt;
        &lt;d:price xmlns:p="moreURL"&gt;
          &lt;d:total&gt;105&lt;/d:total&gt;
        &lt;/d:price&gt;
      &lt;/bookHotelResponse&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p>I am trying to read the above soap message <code>XmlDocument</code> using C#:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>The count is always zero and it is not reading the bookingstatus values.</p>