【发布时间】:2016-02-03 11:38:51
【问题描述】:
我尝试通过 SoapClient 建立连接。我需要一个证书。我收到了 .pfx 证书。我使用以下命令创建了一个 .pem 文件。
openssl pkcs12 -in cert.pfx -out cert.pem -nodes
证书中有密码,所以我需要在获取 cert.pem 文件之前输入密码。到目前为止一切顺利,我认为。
现在我尝试连接到 WSDL 服务。
$url = "https://test.website.com/webservices/transfer.asmx?WSDL";
$cert = '/path/to/cert.pem';
$passphrase = "12345678";
$soapClient = new SoapClient($url, array('local_cert'=>$cert,'passphrase'=>$passphrase));
我收到以下错误:
(警告)SoapClient::SoapClient(): 无法设置私钥文件`/var/www/vhosts/............./cert.pem'
我认为问题出在证书上。我将 .pfx 转换为 .pem 的方式是否正确?
【问题讨论】:
-
我仍然有这个问题。找到了这个。注意:在此处包含“-nodes”标志将防止使用密码来加密私钥。无论是否输入密码,我都会遇到同样的错误。
-
该证书是公共证书还是私人证书?
-
你为什么用
-nodes而不是-clcerts?
标签: php soap certificate pem pfx