I'm trying to access a SOAP API which requires a custom header for authentication. I can create the header fine, as it's just username, password, id, nice and simple, but for some reason when the actual request goes through it only sends username and password, not id.
I create a SoapHeader:
$auth = array("UserName" => $user, "Password" => $password, "ClientId" => $clientId);
$header = new SoapHeader("namespace", "ClientHeader", $auth, FALSE);
$this->client->__setSoapHeaders($header);
I var_dump the created header, client, etc, and verify that UserName, Password and ClientId are all in the header.
SoapClient::__set_state(array(
Extra Fields Removed
'__default_headers' =>
array (
0 =>
SoapHeader::__set_state(array(
'namespace' => 'namespace',
'name' => 'ClientHeader',
'data' =>
array (
'UserName' => 'name',
'Password' => 'password',
'ClientId' => 'id',
),
)),
),
))
But when I make a request only UserName and Password get sent:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace>
<SOAP-ENV:Header>
<ns1:ClientHeader>
<ns1:UserName>name</ns1:UserName>
<ns1:Password>pass</ns1:Password>
</ns1:ClientHeader>
</SOAP-ENV:Header>
Remainder snipped
Anyone have any ideas?
<s:complexType name="ClientHeader"><s:sequence><s:element minOccurs="0" maxOccurs="1" name="ClientID" type="s:string"/><s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string"/><s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/></s:sequence><s:anyAttribute/></s:complexType>