SoapClient构造函数适用于7.1,适用于7.2

时间:2018-09-18 12:01:47

标签: php soap wsdl

我的SoapClient构造函数可在7.1中使用,但在7.2中失败会返回错误

 [message:protected] => SOAP-ERROR: Parsing WSDL: 
 Couldn't load from 'https://domain/url.svc?singleWsdl' : failed to load external entity

WSDL URI似乎是合法的。我可以从浏览器中调用它并获取WSDL文档。有什么想法要看吗?

    $opts = array(
            'ssl' => array(
            'ciphers' => 'RC4-SHA',
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    );

    $params = array(
        'encoding' => 'UTF-8',
        'verifypeer' => false,
        'verifyhost' => false,
        'soap_version' => SOAP_1_1,
        'trace' => 1,
        'exceptions' => 1,
        'connection_timeout' => 180,
        'stream_context' => stream_context_create($opts)
    );

    try {

        $this->_client = new SoapClient($wsdl, $params);

在PHP 7.2中启用了适当的库

[PHP_OPENSSL]
extension=php_openssl.dll
[PHP_SOAP]
extension=php_soap.dll

1 个答案:

答案 0 :(得分:0)

就我而言,问题是由于未加载证书引起的。

[openssl]
openssl.cafile="/path/to/cacert.pem"

检查文件是否存在。