Using SoapClient in PHP 5.3.28 would like to create a soap header that looks like:
<soap:Header>
<ns:RequestParams Size="Large" Color="Blue" Brand="xyz">
</soap:Header>
If I construct the header like this:
$params = array('RequestParams' => array('Size' => 'Large', 'Color' => 'Blue', 'Brand' => 'xyz');
$header = new SoapHeader(NameSpace, 'RequestParams', $params);
$client = new SoapClient(NULL, array("location" => "https://endpoint-url",
"uri" => "http://namespace-uri",
"soap_version" => SOAP_1_2, "trace" => 1));
$client->__setSoapHeaders($header);
$result = $client->__soapCall(some soap call here);
echo $client->__getLastRequest() . "\n";
The header I get is:
<env:Header>
<ns2:RequestParams>
<item><key>RequestParams</key><value>
<item><key>Size</key><value>Large</value></item>
<item><key>Color</key><value>Blue</value></item>
<item><key>LastName</key><value>xyz</value></item></value>
</item>
</ns2:RequestParams>
</env:Header>
and I get a response from the server telling me it's an invalid header. I've searched around and there doesn't appear to be too much info on how PHP soapclient creates headers from data strctures. Any idea how I can get the header format I want using SoapClient? Any pointers appreciated.