使用 php SOAPclient 并收到错误:“必须通过安全通道查看此页面”


using php SOAPclient and getting error: "this page must be viewed over secure channel"

我正在尝试从Web服务调用php SOAPclient的方法,但收到以下错误:

PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Forbidden ( The page must be viewed over a secure channel (Secure Sockets Layer (SSL)). Contact the server administrator.  ) 
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://www.ebri...', 'eBridge.WebServ...', 1, 0)
#1 /var/application/test-control4-xml.php(284): SoapClient->__call('GetDocumentList', Array)
#2 /var/application/test-control4-xml.php(284): SoapClient->GetDocumentList(Array)
#3 {main}

这是我正在使用的代码:

$client = new SoapClient("https://www.ebridgeservices.com/ePortalService.asmx?WSDL");
$params=
array( 'login' => $user,
    'password' => $password,
    'status'=>'All',
    'docType'=>'850',
    'fromDate'=> $from_date,
    'toDate'=> $to_date,        
    'partner'=>'OurPartner') ;          
$results = $client->GetDocumentList($params);       
var_dump($results->GetDocumentListResponse); 

如您所见,我使用的是https地址,因此我不确定为什么会收到此错误。 我做错了什么吗?

此错误的常见原因是当您的 php 版本在没有 openssl 库的情况下编译时。简单地说,你的php无法通过https连接发出请求。

检查你的phpinfo()输出,看看你有openssl或任何类型的SSL支持。

将该 WSDL 提供给 http://soapclient.com/soaptest.html 表明该 WSDL 文件中的链接指向其服务器上的 http://URL,而不是 https://。可能想问问他们的支持。