title: Modifying PHP / SOAP code to add HTTP Header in all requests
body: <p>I;ve inherited some php SOAP code and due to changes in the service we are using, I need to modify to "add an authorization in the HTTP headers of all requests". I'm not sure what to do and if its even possible.</p>
  
  <p>Part of the relevant code looks like this:</p>
  
  <pre><code>    function soap_connect() {
              $soap_options = array(
                      'soap_version' =&gt; SOAP_1_2,
                      'encoding' =&gt; 'UTF-8',
                      'exceptions' =&gt; FALSE
              );
              try {
                      $this-&gt;soap_client = new SoapClient($this-&gt;configuration['wsdl'], $soap_options);
              } catch (SoapFault $fault) {
                      return FALSE;
              }
              return TRUE;
      }
  </code></pre>
  
  <p>I think, as I understand it, it should be just outputting the following (right now):</p>
  
  <pre><code>Content-Type: application/soap+xml;charset=UTF-8;action="http://ws.testserver.net/nsp/client/hsserve/listHardware"
  Content-Length: 255
  ...
  </code></pre>
  
  <p>The documentatino says that the final HTTP request should look like:</p>
  
  <pre><code>Content-Type: application/soap+xml;charset=UTF-8;action="http://ws.testserver.net/nsp/client/hsserve/listHardware"
  Authorization: WRAP access_token=Z-H7SnqL49eQ2Qp5pLH8k-RVxHfewgIIDt4VCeI2CNnrS4-gBMzPWbfZuMhgvISVV-uTSikS1SqO0n2PRkH3ysQ-uWbvU9podPAm6HiiIS5W2mtpXUfN9ErBmkjF6hDw
  Content-Length: 255
  </code></pre>