title: Creating a SOAP call using PHP with an XML body
body: <p>I'm trying to call a SOAP method using PHP.</p>
  
  <p>Here's the code I've got:</p>
  
  <pre><code>$data = array('Acquirer' =&gt;
    array(
      'Id' =&gt; 'MyId',
      'UserId' =&gt; 'MyUserId',
      'Password' =&gt; 'MyPassword'
    ));
  $method = 'Echo';
  $client = new SoapClient(NULL,
             array('location' =&gt; 'https://example.com/ExampleWebServiceDL/services/ExampleHandler', 
             'uri' =&gt; 'http://example.com/wsdl', 'trace' =&gt; 1));
  $result = $client-&gt;$method($data);
  </code></pre>
  
  <p>Here's the request it creates:</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.com/wsdl" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SOAP-ENV:Body&gt;
        &lt;ns1:Echo&gt;
          &lt;param0 xsi:type="ns2:Map"&gt;
            &lt;item&gt;
              &lt;key xsi:type="xsd:string"&gt;Acquirer&lt;/key&gt;
              &lt;value xsi:type="ns2:Map"&gt;
                &lt;item&gt;
                  &lt;key xsi:type="xsd:string"&gt;Id&lt;/key&gt;
                  &lt;value xsi:type="xsd:string"&gt;mcp&lt;/value&gt;
                &lt;/item&gt;
                &lt;item&gt;
                  &lt;key xsi:type="xsd:string"&gt;UserId&lt;/key&gt;
                  &lt;value xsi:type="xsd:string"&gt;tst001&lt;/value&gt;
                &lt;/item&gt;
                &lt;item&gt;
                  &lt;key xsi:type="xsd:string"&gt;Password&lt;/key&gt;
                  &lt;value xsi:type="xsd:string"&gt;test&lt;/value&gt;
                &lt;/item&gt;
              &lt;/value&gt;
            &lt;/item&gt;
          &lt;/param0&gt;
        &lt;/ns1:Echo&gt;
      &lt;/SOAP-ENV:Body&gt;
    &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>And here's what I <em>want</em> the request to look like:</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.com/wsdl" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SOAP-ENV:Body&gt;
        &lt;Echo&gt;
          &lt;Acquirer&gt;
            &lt;Id&gt;MyId&lt;/Id&gt;
            &lt;UserId&gt;MyUserId&lt;/UserId&gt;
            &lt;Password&gt;MyPassword&lt;/Password&gt;
          &lt;/Acquirer&gt;
        &lt;/Echo&gt;
      &lt;/SOAP-ENV:Body&gt;
    &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>