【问题标题】:How to set this php soap header?如何设置这个 php soap 标头?
【发布时间】:2019-10-04 00:38:42
【问题描述】:

我如何设置这个 php Soap Header ??对于我的生活,我无法弄清楚。

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

谢谢大家!

【问题讨论】:

  • 你使用的是 PHP 的 soapclient 吗?

标签: php soap header


【解决方案1】:

看到这条评论:

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

所以它会是这样的:

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

//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header); 

【讨论】:

  • 两个问题: 1. $ns 中有什么内容? 2.'RequestorCredentials'来自哪里?
  • @pilat 检查答案中的链接
  • 非常感谢它也帮助了我!
猜你喜欢
  • 2012-02-18
  • 1970-01-01
  • 1970-01-01
  • 2020-09-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多