我有这个标题结构:
<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中的?
我试过:
$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。
发布于 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);
https://stackoverflow.com/questions/14161404
复制相似问题