title: Parsing a SOAP Response with C#
body: <p>I've been trying to use the data from an API but I have not been able to read the XML Response from it.</p>
  
  <p>It cames in the form:</p>
  
  <pre><code>    &lt;?xml version="1.0" standalone="no"?&gt;
          &lt;SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
          &lt;SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
              &lt;SOAPSDK4:GetStoreProductsResponse xmlns:SOAPSDK4="http://www.externalwebservice.com/message/"&gt;
                  &lt;StoreProducts&gt;
                      &lt;StoreID&gt;&lt;/StoreID&gt;
                      &lt;Products&gt;&lt;/Products&gt;
                  &lt;/StoreProducts&gt;
              &lt;/SOAPSDK4:GetStoreProductsResponse&gt;&lt;/SOAP-ENV:Body&gt;
          &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>And what I need is what is inside <i>Products</i> (for now).</p>
  
  <p>I was trying to use <a href="https://stackoverflow.com/questions/2876012/">Using C# to parse a SOAP Response</a> (and others to not flood this) without results.</p>
  
  <p>My code:</p>
  
  <pre><code>    XDocument tst = XDocument.Load("Response.xml");
      XNamespace xmlns = "http://schemas.xmlsoap.org/soap/envelope/";
      var tstr = from result in tst.Descendants(xmlns + "StoreProducts") select result.Element("Products").Value;
  </code></pre>
  
  <p>I am almost sure that I am missing something basic.</p>
  
  <p>Any clue will be really appreciated.</p>
  
  <p>Thank you.</p>