title: How to get Soap Fault details elements in ASP.NET Core app
body: <p>I try to cath a SOAP exception from ASMX Websirvice in my ASP.NET Core API.</p>
  
  <p>The legacy ASMX Webservice throw a SOAP Exception like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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"&gt;
      &lt;soap:Body&gt;
          &lt;soap:Fault&gt;
              &lt;faultcode&gt;soap:Client&lt;/faultcode&gt;
              &lt;faultstring&gt;System.Web.Services.Protocols.SoapException: An order must be specified
     at legacyNamespace.Common.WebServiceBase.CheckUserPermissionsForProject(String projectId)
     at legacyNamespace.CustomerApp.Defect.Defect.AcceptDefect(AcceptDefectModel defect)&lt;/faultstring&gt;
              &lt;detail&gt;
                  &lt;errorCode&gt;400&lt;/errorCode&gt;
                  &lt;message&gt;An order must be specified&lt;/message&gt;
              &lt;/detail&gt;
          &lt;/soap:Fault&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  
  </code></pre>
  
  <p>Now I'm trying to catch and process this exception in my ASP.NET Core 2.2 Web API:</p>
  
  <pre><code>try
  {
     // call the asmx service
  }
  catch (FaultException ex)
  {
     var fault = ex.CreateMessageFault();
     if (fault.HasDetail)
     {
        var faultDetails = fault.GetDetail&lt;XmlElement&gt;();
        var test = faultDetails.InnerText;
     }
     ...
  }
  
  </code></pre>
  
  <p>And the <code>test</code> var contains only the errorCode "400" and nothing more. <code>faultDetails</code> ChildNodes are empty.
  If I try to call <code>GetDetail&lt;XmlNode&gt;()</code> than I got a serialization exception.
  How can I get all detail elements?</p>