How to use the soapAction header with PHP SoapClient
<p>I have a php SoapClient PHP that I'm trying to get working. The SoapClient authenticates and can grab the WSDL, no problem. Then I need to initiate a soapAction using the WSDL as the endpoint, but the headers do not match the demonstration request headers I'm required to match. </p>

<p><em>Specifically, I'm missing the soapAction header and instead am getting a action parameter being set inside the Content Type. How do I change this?</em></p>

<p><strong>The headers I want to be generating:</strong></p>

<pre><code>POST /hpq/hpq-service/hpq.wsdl HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "HPQMemberValidationOperation"
Authorization: Basic EEV0Y2VsbHM898Q4c2dLSjg5aEdYenBLYmQ0akhr
Content-Length: 902
Host: ****
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
</code></pre>

<p><strong>The headers that I am generating:</strong></p>

<pre><code>POST /hpq/hpq-service/hpq.wsdl HTTP/1.1
Host: ***
Connection: Keep-Alive
User-Agent: PHPSoapClient
Content-Type: application/soap+xml; charset=utf-8; action="HPQMemberValidationOperation"
Content-Length: 688
Authorization: Basic EEV0Y2VsbHM898Q4c2dLSjg5aEdYenBLYmQ0akhr
</code></pre>

<p>And I am calling this action via the following php code:</p>

<pre><code>   $opts = array(
       'http'=&gt;array(
           'user_agent' =&gt; 'PHPSoapClient',
           'header' =&gt; "Authorization: Basic " . base64_encode("$username:$password"),
       ),
       'ssl' =&gt; array(
           'ciphers'=&gt;'RC4-SHA',
           'verify_peer'=&gt;false,
           'verify_peer_name'=&gt;false
       ),
   );
   ini_set( "soap.wsdl_cache_enabled", "0" );

   $context = stream_context_create($opts);
   $params = array(
       'stream_context'=&gt;$context,
       'cache_wsdl' =&gt; WSDL_CACHE_NONE,
       'encoding' =&gt; 'UTF-8',
       'verifypeer' =&gt; false,
       'verifyhost' =&gt; false,
       'soap_version' =&gt; SOAP_1_2,
       'trace' =&gt; 1,
       'exceptions' =&gt; 1,
       'connection_timeout' =&gt; 180,
   );
   $client = new SoapClient(WSDL_PATH, $params);

   $response = $client-&gt;__soapCall('HPQMemberValidationOperation', array($payload), array('location'=&gt;WSDL_PATH));
</code></pre>