我正在尝试使用以下代码设置Soap客户端:

<?php
$wsdl           = 'https://domain.com/?wsdl';
$endpoint       = 'https://domain.com';
$certificate    = dirname(__FILE__) . '/CertWithKey.pem';
$password       = 'pwd';

$options = array(
    'location'      => $endpoint,
    'keep_alive'    => true,
    'trace'         => true,
    'local_cert'    => $certificate,
    'passphrase'    => $password,
    'cache_wsdl'    => WSDL_CACHE_NONE
);

try {
    $soapClient = new SoapClient($wsdl, $options);
} catch(Exception $e) {
    var_dump($e);
}

我得到了一个带有.crt认证文件的.p12 key 文件。我使用openssl将.p12文件转换为.pem文件,然后将其与.crt文件合并。 CertWithKey.pem对我来说不错,该文件中有两个证书块。

无论我做什么,我都会不断收到SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://domain.com/?wsdl' : failed to load external entity "https://domain.com/?wsdl"消息异常。

与对方通话后,他们确认有一个请求传入,但他们正在记录此错误:ssl handshake interrupted by system [hint: stop button pressed in browser?!]

由于到目前为止我在网上找不到任何有用的信息,所以我想请你们对此事有一些见识。

有什么建议可以尝试吗?我正在运行PHP 5.3.8,并且该服务器的IP地址在远程方的防火墙中列出为白色。

最佳答案

我已经解决了这个问题。我认为,由于与此问题相关的问题数量众多,并且解决方案数量众多,因此其他人将从该解决方案中受益。开始:

我使用了openssl CLI程序将.p12 key 文件转换为.pem key 文件。诀窍是转换发生的方式。

首先,我使用此命令对其进行了转换,并遇到了问题中所述的问题:
openssl pkcs12 -in key.p12 -out key.pem -nodes -clcerts
虽然下面的命令做了实际的把戏:
openssl pkcs12 -in key.p12 -out key.pem -clcerts
有关更多信息,请参见我使用的来源:https://community.qualys.com/docs/DOC-3273

10-06 06:02
查看更多