【发布时间】:2018-01-26 07:50:32
【问题描述】:
服务文档说我需要使用 WS-Security。 在他们的支持下,我得到了一个 p12 文件,我应该使用它。
到目前为止我做了什么
我运行了 SoapUI 应用程序,对其进行了配置,添加了 wsdl 等,并收到了消息
<faultstring>These policy alternatives can not be satisfied: (...)</faultstring>
所以我发现我需要在请求中添加基本的身份验证。我得到了正确的答案。
我现在需要什么
我需要在我的 PHP 应用程序上使用它来处理 SOAP 请求。
首先,我将p12 文件更改为pem,然后尝试:
$soapClient = new SoapClient('https://int.pz.gov.pl/pz-services/tpSigning?wsdl',
array('location' => 'https://int.pz.gov.pl/pz-services/tpSigning?wsdl',
'trace' => 1,"exceptions" => 1,
'local_cert'=>'path/cert_file.pem',
'passphrase'=>'cert_password'
));
但我仍然收到关于不满足政策的相同失败消息:
These policy alternatives can not be satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}AsymmetricBinding: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token: The received token does not match the token inclusion requirement
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SignedParts: Soap Body is not SIGNED in (...)
帮助?
仅使用 PHP 是否有可能?我尝试了几种解决方案,找到了一些扩展 SoapClient 的类(使用用户/密码,而不是 p12/pem 文件),甚至在 c# 中找到了解决方案(如果这是我需要做的,我已经准备好使用它 - 使用 WebSocket 将 xml 发送到 c# ,并将其发送回浏览器),但这些都不起作用。
【问题讨论】:
标签: php xml web-services soap ws-security