7

How do i set this php Soap Header ?? For the life of me I can't figure it out.

   <soapenv:Header>
    <wsse:HeaderOne soapenv:mustUnderstand="1">
        <wsse:UsernameKey wsu:Id="tun-12345">
            <wsse:Username>myusername</wsse:Username>
            <wsse:Password>mypassword</wsse:Password>
        </wsse:UsernameKey>
    </wsse:HeaderOne>
   </soapenv:Header>

Thanks guys !

koos
  • 93
  • 1
  • 2
  • 4

1 Answers1

13

See this comment:

http://www.php.net/manual/en/soapclient.setsoapheaders.php#93460

So it would be like:

$headerbody = array('UsernameKey'=>array('Username'=>$UserID,
                                         'Password'=>$Pwd)); 
$header = new SoapHeader($ns, 'RequestorCredentials', $headerbody);       

//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header); 
tristanbailey
  • 4,427
  • 1
  • 26
  • 30
rickyduck
  • 4,030
  • 14
  • 58
  • 93