我尝试通过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的方式正确吗?