title: Soap authentication header and request using PHP
body: <p>I am trying to setup a SOAP call for an online restaurant table booking service but haven't been able to get it working.
  It uses authentication header and have tried the following code without any luck:</p>
  
  <pre><code>$username = '';
  $password = '';
  
  $soapURL = "http://m.cmd-it.dk/reservations.asmx?WSDL";
  
  $client = new SoapClient($soapURL,array());
  
  $auth = array(
      'UserName' =&gt; $username,
      'Password' =&gt; $password,
      'createReservation'=&gt; array(
          'reservation2CompanyName' =&gt; 'Tester',
          'customerFirstName' =&gt; 'test',
          'customerLastName' =&gt; 'tester',
          'customerTelephoneNumber' =&gt; '22334455',
          'customerMail' =&gt; 'test@example.com',
          'reservationDate' =&gt; date("j/m/Y", time()),
          'reservationTime' =&gt; date("H:i", time()),
          'reservationPAX' =&gt; '3',
          'reservationRemarks' =&gt; 'test',
          'TestMode' =&gt; 1
      )
  );
  $header = new SoapHeader('http://cmd-it.dk/','authentification',$auth,false);
  $client-&gt;__setSoapHeaders($header);
  
  echo var_dump($client-&gt;__getLastRequestHeaders());
  echo var_dump($client-&gt;__getLastRequest());
  </code></pre>
  
  <p>But it just echo's NULL NULL... :-(</p>
  
  <p>I am not familiar with PHP SOAP calls and not at all using authentication headers, but hope somebody can push me in the right direction.</p>