PHP SoapClient Headers. I'm having a problem getting the namespaces in child nodes. Here's the code I'm using:
$security = new stdClass;
$security->UsernameToken->Password = 'MyPassword';
$security->UsernameToken->Username = 'MyUsername';
$header[] = new SOAPHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $security);
$client->__setSoapHeaders($header);
Here's the XML it generates:
<ns2:Security>
<UsernameToken>
<Password>MyPassword</Password>
<Username>MyUsername</Username>
</UsernameToken>
</ns2:Security>
Here's the XML I want it to generate:
<ns2:Security>
<ns2:UsernameToken>
<ns2:Password>MyPassword</ns2:Password>
<ns2:Username>MyUsername</ns2:Username>
</ns2:UsernameToken>
</ns2:Security>
I need to get the namespace reference into the UsernameToken, Password and Username nodes. Any help would be really appreciated.
Thanks.