2010-02-16 116 views
1

我的任务是重写使用WSE代理与PHP通信的.NET应用程序。 我正在处理一件事。我看到代码 UsernameToken userNameToken1 = new UsernameToken(sToken_UserName, sToken_Password, PasswordOption.SendPlainText); 我假设,它将一个安全头添加到SOAP信封中。我不知道如何在PHP中执行此操作。我想下面的代码片段,我在网上找到的地方用php添加肥皂安全标题

$token = new stdClass; 
$token->Username = new SOAPVar($username, XSD_STRING, null, null, null, $ns); 
$token->Password = new SOAPVar($password, XSD_STRING, null, null, null, $ns); 

$wsec = new stdClass; 
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns); 

$headers = new SOAPHeader($ns, 'Security', $wsec, true); 
$client->__setSOAPHeaders($headers); 

但我得到下面的异常回:

Uncaught SoapFault exception: [SOAP-ENV:Client] com.sun.xml.wss.XWSSecurityException: Receiver Requirement for nonce has not been met; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Receiver Requirement for nonce has not been met 

我在做什么错在这里?是否缺少我需要知道的信息?

回答

0

我花了很多时间尝试各种方法来WS-Security的用PHP。

最后我偶然发现了这个research paper by IBM,概述了一个出色的解决方案。我们现在将其用于与我们的Web服务进行大量集成。