title: Using C# to parse a SOAP Response
body: <p>I am trying to get the values for faultcode, faultstring, and OrderNumber from the SOAP below</p>
  
  <pre><code>&lt;SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;SOAP:Body&gt;
          &lt;faultcode&gt;1234&lt;/faultcode&gt; 
          &lt;faultstring&gt;SaveOrder:SetrsOrderMain:Cannot change OrderDate if GLPeriod is closed, new OrderDate is 3/2/2010:Ln:1053&lt;/faultstring&gt;               
          &lt;detail&gt;
             &lt;SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"&gt;
             &lt;SOAP:Body UserGUID="test"&gt;
             &lt;m:SaveOrder xmlns:m="http://www.test.com/software/schema/" UserGUID="test"&gt;
                  &lt;Order OrderNumber="1234-1234-123" Caller="" OrderStatus="A" xmlns="http://www.test.com/software/schema/"&gt;
  </code></pre>
  
  <p>Here is my code in C#</p>
  
  <pre><code>XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLexample.xml"));
  
  var errorDetail = new EcourierErrorDetail
  {
     FaultCode = from fc in doc.Descendants("faultcode")
                 select fc.Value,
     FaultString = from fs in c.Descendants("faultstring")
                   select fs.Value,
     OrderNumber = from o in    
                   doc.Descendants("detail").Elements("Order").Attributes("OrderNumber")
                   select o.Value
  };
  return errorDetail;
  </code></pre>
  
  <p>I am able to get the values for both faultcode and faultstring but not the OrderNumber. I am getting "Enumeration yielded no results." Can anyone help?  Thanks.</p>