我正在尝试连接到需要客户端证书的soap服务 . 我目前正在使用XAMPP从localhost开发 .
我收到的来自SOAP服务提供商的文件(客户端证书)作为普通的.txt文件来到我这里 . 我不知道它是什么格式,但我将它重命名为to.crt并且它在Windows 10中安装得很好 - 该服务在SoapUI中工作 .
我采取的步骤:
1)将证书保存为soap.service.crt
2)安装证书(Windows 10) - 这使SoapUI工作 . 请求和响应正常 .
现在,我需要在Apache / PHP中使用它
我是这样设置的:
(请求数组未显示 . 目标地址为https . )
$my_cert_file = "c:\\xammp\htdocs\website\trunk\soap.service.crt";
$wsdl = "https://some.com/arbitrary/service?wsdl";
$context = stream_context_create([
'ssl' => [
// set some SSL/TLS specific options
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]);
try
{
$client = new SoapClient ($wsdl, array('trace' => 1, 'local_cert'=>$my_cert_file, 'context'=>$context));
}
catch(Exception $e)
{
echo $e->getMessage();
return;
}
$client->__setSoapHeaders(soapClientWSSecurityHeader());
// I am calling a WSS method - checked and works fine in SoapUI.
$result = $client->authenticateMember($params);
$request = $client->__getLastRequest();
$response = $client->__getLastResponse();
我的实际问题:
我读到我必须在我的证书中包含一个密钥,基本上是我的私钥与收到的证书连接在一起 .
1)这个连接证书需要采用什么格式? 2)如何生成此私钥 - 是否需要输入客户端证书(换句话说,是从“.crt文件”生成的私钥?)3)如何进行所有这些 - 什么工具我用吗? (我确实可以访问Ubuntu 16.04 vm)4)呼叫设置对您来说是否正确?
最后,这是我得到的错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://some.com/arbitrary/service?wsdl' : failed to load external entity "https://https://some.com/arbitrary/service?wsdl"