title: SOAP Envelope Element is not declared
body: <p>I have an issue with a SOAP request I'm sending to an external ASP Web Service. I have used both SoapUI and PHP's <code>SoapClient</code> class, and both times the same issue occurs - an error that tells me <code>The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.</code></p>
  
  <p><strong>My Request to 'GetStudentEntitlement'</strong> </p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/" xmlns:heim="http://dest.gov.au/Heims/"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;&lt;adm:GetStudentEntitlement&gt;
           &lt;heim:entitlementRequest&gt;
              &lt;heim:RequestControlTable&gt;
                 &lt;heim:RequestId&gt;CDD1E704-1298-4D42-AAD9-0031BB90329F&lt;/heim:RequestId&gt;
                 &lt;heim:ClientOrganisationCode&gt;7591&lt;/heim:ClientOrganisationCode&gt;
                 &lt;heim:RequestLocalDateTime&gt;2015-08-10T00:00:00&lt;/heim:RequestLocalDateTime&gt;
              &lt;/heim:RequestControlTable&gt;
              &lt;heim:GetEntitlementIn&gt;
                 &lt;heim:RecordId&gt;CDD1E704-1298-4D42-AAD9-0031BB90329F&lt;/heim:RecordId&gt;
                 &lt;heim:Chessn&gt;1344&lt;/heim:Chessn&gt;
                 &lt;heim:FamilyName&gt;Bassett&lt;/heim:FamilyName&gt;
                 &lt;heim:BirthDate&gt;1988-05-21&lt;/heim:BirthDate&gt;
              &lt;/heim:GetEntitlementIn&gt;
           &lt;/heim:entitlementRequest&gt;
        &lt;/adm:GetStudentEntitlement&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p><strong>The response:</strong></p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/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;soap:Code&gt;
              &lt;soap:Value&gt;soap:Sender&lt;/soap:Value&gt;
           &lt;/soap:Code&gt;
           &lt;soap:Reason&gt;
              &lt;soap:Text xml:lang="en"&gt;Heims.WebServices.Extensions.Exceptions.XmlSchemaValidationException: Schema validation errors
     at Heims.WebServices.Extensions.SoapFilterExtension.ValidateXmlMessage(SoapMessage message, WebMethodSettings methodSettings) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 408
     at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessageBeforeDeserialise(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 200
     at Heims.WebServices.Extensions.SoapFilterExtension.ProcessMessage(SoapMessage message) in c:\Userdata\HEIMS.NET\Source\Development\WebService\Heims.WebService.Common\Extensions\SoapFilterExtension.cs:line 173
     at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)
     at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
     at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()&lt;/soap:Text&gt;
           &lt;/soap:Reason&gt;
           &lt;detail&gt;
              &lt;ValidationError&gt;
                 &lt;RecordId/&gt;
                 &lt;Element&gt;Envelope&lt;/Element&gt;
                 &lt;Line&gt;1&lt;/Line&gt;
                 &lt;Column&gt;2&lt;/Column&gt;
                 &lt;Description&gt;The 'http://www.w3.org/2003/05/soap-envelope:Envelope' element is not declared.&lt;/Description&gt;
              &lt;/ValidationError&gt;
           &lt;/detail&gt;
        &lt;/soap:Fault&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I have tried adding and removing the trailing <code>/</code> on the <code>:soap</code> declaration, as well as trying both the <code>1.1</code> and <code>1.2</code> SOAP versions offered by this web service.</p>
  
  <p>This endpoint request to <strong>'Ping'</strong> <em>works correctly</em>:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:adm="http://dest.gov.au/Heims/Admin/"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;adm:Ping/&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>The result is returned as expected:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/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;PingResponse xmlns="http://dest.gov.au/Heims/Admin/"&gt;
           &lt;PingResult&gt;Heims web services pinged. DateTime = 2015-08-10 11:11:00:05&lt;/PingResult&gt;
        &lt;/PingResponse&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>So <em>why</em> would the code for one request (the ping) work perfectly, while the other request (GetStudentEntitlement) fails? Both have the <code>soap:Envelope</code> declaration, but the Ping request works fine.</p>
  
  <p>I have also tried using <code>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"</code> in the <code>soap:Envelope</code> element, but the error remained.</p>
  
  <p>Is it possible that this is a server-side issue from the Web Service itself? Or is something simply going wrong in my code?</p>