title: PHP - Use multiple xmlns in Envelope with SoapClient
body: <p>I'm trying to make a SOAP call with multiple xmlns namespaces in the soap call envelope, but I can't figure out how to do it properly...</p>
  
  <p>Here's the code I have right now :</p>
  
  <pre><code>$soapClient = new SoapClient(WSDL_URL, array(
              "trace" =&gt; true,
              "exceptions" =&gt; true
          ));
  $soapClient-&gt;__setLocation(WSDL_LOCATION);
  
  $request = '
          &lt;ns1:someNodeName xmlns="http://some.webservice.url.com"&gt;
              &lt;ns2:someOtherNodeName&gt;
                  // [REQUEST DETAILS]
              &lt;/ns2:someOtherNodeName&gt;
          &lt;/ns1:someNodeName&gt;
      ';
  
  $params = new SoapVar($request, XSD_ANYXML);
  
  try {
      $results = $soapClient-&gt;someFunctionName($params);
      return $results;
  }
  catch (Exception $e) {
      $error_xml =  $soapClient-&gt;__getLastRequest();
      echo $error_xml . "\n";
      echo $e-&gt;getMessage() . "\n";
  }
  </code></pre>
  
  <p>This code gives me an XML request like the following :</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://some.webservice.url.com"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:someNodeName xmlns="http://some.webservice.url.com"&gt;
              &lt;ns2:someOtherNodeName&gt;
                  // [REQUEST DETAILS]
              &lt;/ns2:someOtherNodeName&gt;
          &lt;/ns1:someNodeName&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>What I'm trying to change is the Envelope line, to get something like :</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope 
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:ns1="http://some.webservice.url.com" 
      xmlns:ns2="http://some.other.webservice.url.com"
  &gt;
  </code></pre>
  
  <p>Is there any way I can achieve this please ?</p>