【问题标题】:How do I fix error on SOAP call in my OpenCart PHP code?如何修复 OpenCart PHP 代码中的 SOAP 调用错误?
【发布时间】:2016-12-12 10:13:18
【问题描述】:

我正在尝试在我的 PHP 代码中进行 SOAP 调用。代码在file1.php 中,而SOAP 在WSDL 文件soap.xml 中。新的 SoapClient() 在第 150 行

file1.php 是 OpenCart 2.3 中的一个控制器文件

$user = 'user';
$password = 'password';
$wsdl = 'soap.xml'

$client = new SoapClient($wsdl,array('login' => "$user", 'password' => "$password", 'encoding'=>'ISO-8859-1', 'trace'=>1, 'stream_context' => stream_context_create(array('https' => array('protocol_version' => 1.0) ) ), 'cache_wsdl'=>WSDL_CACHE_NONE));

这是我不断收到的错误:

SoapClient::SoapClient(): SSL operation failed with code 1. OpenSSL

Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in <b>file1.php</b> on line <b>150</b><b>Warning</b>: SoapClient::SoapClient(): Failed to enable crypto in <b>file1</b> on line <b>150</b><b>Warning</b>: SoapClient::SoapClient (https://soap.xml): failed to open stream: operation failed in <b>file1.php</b> on line <b>150</b><b>Warning</b>: SoapClient::SoapClient(): I/O warning : failed to load external entity &quot;https:soap.xml&quot; in <b>file1.php</b> on line <b>150</b>

我该如何解决这个问题?

【问题讨论】:

标签: php soap opencart


【解决方案1】:

我查看了 Jean-maxime Bouloc 建议的链接。我对新的 SoapClient() 调用进行了如下调整:

$client = new SoapClient($wsdl,array('login' => "$user", 'password' => "$password", 'encoding'=>'ISO-8859-1', 'trace'=>1, 'stream_context' => stream_context_create(array('https' => array('protocol_version' => 1.0), 'ssl' => array('verify_peer' => false, 'verify_peer_name'=> false,) ) ), 'cache_wsdl'=>WSDL_CACHE_NONE));

我要感谢 Jean-maxime Bouloc 帮助我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-21
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 2023-04-05
    • 2018-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多