首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用php验证soapheader

使用php验证soapheader
EN

Stack Overflow用户
提问于 2013-01-04 16:57:04
回答 1查看 15.6K关注 0票数 2

可能重复: PHP SoapClient and a complex header

我有这个标题结构:

代码语言:javascript
复制
<soapenv:Header>
  <wsse:Security xmlns:wsse=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd” soapenv:mustUnderstand=”0”>
    <wsse:UsernameToken>
    <wsse:Username Type=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken”>votre_login</wsse:Username>
    <wsse:Password Type=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText”>votre_password</wsse:Password>
    </wsse:UsernameToken>
  </wsse :Security>
</soapenv :Header>

我是如何使用__setSoapHeaders()方法将其放入php中的?

我试过:

代码语言:javascript
复制
$auth = array(
            'UsernameToken' => array(
                'Username' => '*****',
                'Password' => '*****'
            )
        );
$header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','Security',$auth, 0);
$client->__setSoapHeaders($header);

我有个错误:

com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5509E: Un jeton de sécuritéle le type est [http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken] est requis。

EN

回答 1

Stack Overflow用户

发布于 2013-01-04 16:59:24

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

要创建复杂的SOAP头,您可以这样做: 必需的SOAP头: 字符串字符串 对应的PHP代码: $ns = 'http://namespace.example.com/';// WS的名称空间。Soap头的//主体。$headerbody =数组(‘Token’=> $someToken,'Version‘=> $someVersion,’MerchantID‘=’$MerchantID,‘UserCredentials’=>数组(‘UserID’=‘$UserID,’Password‘=’$$Pwd‘);//创建Soap头。$header =新SOAPHeader($ns,'RequestorCredentials',$headerbody);//设置Soap客户端的头。$soap>_setSoapHeader($header);

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14161404

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档