title: Create this SOAP XML request with PHP's SOAP extension
body: <p>I'm trying to recreate this XML request using PHP's <a href="http://www.php.net/manual/en/book.soap.php" rel="nofollow">SOAP extension</a> and having trouble doing it:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.web.stormpost.skylist.com"&gt;
    &lt;soapenv:Header&gt;
      &lt;authInfo xmlns:soap="http://skylist.com/services/SoapRequestProcessor" xsi:type="soap:authentication"&gt;
        &lt;!--You may enter the following 2 items in any order--&gt;
        &lt;username xsi:type="xsd:string"&gt;****@example.com&lt;/username&gt;
        &lt;password xsi:type="xsd:string"&gt;*******&lt;/password&gt;
      &lt;/authInfo&gt;
    &lt;/soapenv:Header&gt;
    &lt;soapenv:Body&gt;
      &lt;ser:doImportFromTemplate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
        &lt;impTempId xsi:type="xsd:int"&gt;7&lt;/impTempId&gt;
        &lt;data xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string"&gt;
  Joe|Doe|joe@example.com John|Doe|john@example.com &lt;/data&gt;
      &lt;/ser:doImportFromTemplate&gt;
    &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Here is my testing code so far:</p>
  
  <pre class="lang-php prettyprint-override"><code>// set connection params
  $wsdl = 'http://api.stormpost.datranmedia.com/services/SoapRequestProcessor?wsdl';
  $namespace = 'https://api.stormpost.datranmedia.com/services/SoapRequestProcessor';
  $credentials = (object)array(
      'username' =&gt; '****@example.com',
      'password' =&gt; '*******'
  );
  $auth_values = new SoapVar($credentials, SOAP_ENC_OBJECT);
  $header =  new SoapHeader($namespace, "authInfo", $auth_values);
  
  // set client, headers, and call function
  $client = new SoapClient($wsdl, array('trace' =&gt; true));
  $client-&gt;__setSoapHeaders(array($header));
  $client-&gt;__soapCall("doImportFromTemplate", array(7, 'Joe|Doe|joe@example.com John|Doe|john@example.com'));
  </code></pre>
  
  <p>It doesn't seem to be implementing the <em>authInfo</em> node correctly with the <code>xsi:type="soap:authentication"</code> among other things. How should I change my code to output this XML? I'm having trouble finding good implementation examples.</p>