How to set this soap php header?

How to set this header for php header? For life, I can’t understand.

<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!

+5
source share
2 answers

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); 
+7
source

I feel that the answer to this question is a little misleading; The WSSE headers, as in the snippet of the OP example, are a bit more complicated ...

A detailed example of the correct implementation using PHP SoapClient can be found here: http://www.php.net/manual/en/soapclient.soapclient.php#97273

+2
source

Source: https://habr.com/ru/post/895569/


All Articles