title: Sending Raw XML via PHP SoapClient request
body: <p>I am trying to simply send RAW xml to a webservice via PHP and SoapClient. The problem is when I encode my XML it changes the order of elements in the XML that is converted to an associative array. </p>
  
  <pre><code>// Initialize the Soap Client:
  $this-&gt;_transactionServicesClient = new SoapClient($soapWSDLUrl);
  </code></pre>
  
  <p>How or what would be the best way to send the following XML as a string to my SoapClient?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.micros.com/pos/les/TransactionServices"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:PostTransaction&gt;
              &lt;ns1:REQ&gt;
                  &lt;ns1:RequestHeader&gt;
                      &lt;ns1:InterfaceVersion&gt;3.0.7&lt;/ns1:InterfaceVersion&gt;
                      &lt;ns1:ClientName&gt;TRANS_SERVICES&lt;/ns1:ClientName&gt;
                  &lt;/ns1:RequestHeader&gt;    
                  &lt;ns1:CheckDetailEntries&gt;
                      &lt;ns1:MenuItem&gt;
                          &lt;ns1:ReferenceEntry&gt;Pizza4&lt;/ns1:ReferenceEntry&gt;
                          &lt;ns1:Count&gt;1&lt;/ns1:Count&gt;
                          &lt;ns1:Price&gt;10.00&lt;/ns1:Price&gt;
                          &lt;ns1:ItemNumber&gt;112001&lt;/ns1:ItemNumber&gt;
                          &lt;ns1:PriceLevel&gt;1&lt;/ns1:PriceLevel&gt;
                          &lt;ns1:Seat xsi:nil="true"/&gt;
                      &lt;/ns1:MenuItem&gt;
                  &lt;/ns1:CheckDetailEntries&gt;
                  &lt;ns1:CheckHeaderRequest&gt;
                      &lt;ns1:CheckId&gt;03:21:05.050505&lt;/ns1:CheckId&gt;
                      &lt;ns1:GuestCount&gt;1&lt;/ns1:GuestCount&gt;
                      &lt;ns1:GuestInformation&gt;
                      &lt;ns1:ID&gt;001&lt;/ns1:ID&gt;
                      &lt;ns1:FirstName&gt;xxx&lt;/ns1:FirstName&gt;
                      &lt;ns1:LastName&gt;xxx&lt;/ns1:LastName&gt;
                      &lt;ns1:Address1&gt;xxx Rd&lt;/ns1:Address1&gt;
                      &lt;ns1:Address2&gt;xx&lt;/ns1:Address2&gt;
                      &lt;ns1:Address3&gt;xx&lt;/ns1:Address3&gt;
                      &lt;ns1:PhoneNum&gt;xx&lt;/ns1:PhoneNum&gt;
                      &lt;ns1:UserText1&gt;None&lt;/ns1:UserText1&gt;
                      &lt;ns1:UserText2&gt;None&lt;/ns1:UserText2&gt;
                      &lt;ns1:UserText3&gt;None&lt;/ns1:UserText3&gt;
                      &lt;ns1:GUID&gt;&lt;/ns1:GUID&gt;&lt;/ns1:GuestInformation&gt;
                  &lt;/ns1:CheckHeaderRequest&gt;
                  &lt;ns1:OrderTypeNumber&gt;1&lt;/ns1:OrderTypeNumber&gt;
              &lt;/ns1:REQ&gt;
          &lt;/ns1:PostTransaction&gt;
      &lt;/SOAP-ENV:Body&gt;        
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <hr>
  
  <blockquote>
    <p><strong>Update/Resolution:</strong> Here is the code I used to extend the SOAP Client and send my raw Soap Envelope: <a href="https://stackoverflow.com/a/17053242/367456">My answer below</a></p>
  </blockquote>