2

我正在使用 nusoap 连接 Eway legacy Api。突然,Eway 在他们这边强制执行 TLS 1.2。所以我在我的服务器中设置了 open ssl 1.0 和 TLS 1.2。

我正在从该服务器连接运行良好的 Eway rapid api。由于 Legacy 和 Rapid api 都需要 TLS 1.2,并且 rapid 工作正常,这意味着我们的服务器设置没问题。但是这个遗留的 api 连接不起作用。

当我使用 nusoap 连接 Eway 旧版 API 时,我需要通过代码强制执行 TLS 1.2。

代码示例 -

<?php

$client = new nusoap_client("https://www.eway.com.au/gateway/rebill/manageRebill.asmx");
$client->namespaces['man'] = 'http://www.eway.com.au/gateway/rebill/manageRebill';
$headers = "<man:eWAYHeader><man:eWAYCustomerID>****</man:eWAYCustomerID><man:Username>****</man:Username><man:Password>****</man:Password></man:eWAYHeader>";
$client->setHeaders($headers);

$requestbody = array();
$soapactionUrl = 'http://www.eway.com.au/gateway/rebill/manageRebill/';
$requestbody['man:RebillCustomerID'] = $eway_rebill_customer_id;
$requestbody['man:RebillID'] = $eway_rebill_id;
$soapaction = 'QueryRebillEvent';
$client = $this->_creatEwayRebillRequestHeader();

$result = $client->call('man:'.$soapaction, $requestbody, '', $soapactionUrl.$soapaction,true);
$err_msg = $client->getError();
echo $err_msg;
?>

我得到的错误按摩是-

wsdl 错误:获取https://www.eway.com.au/gateway/rebill/manageRebill.asmx- HTTP 错误:不支持的 HTTP 响应状态 403 禁止(soapclient->response 具有响应的内容)

我确信我的凭据,eway 支持团队也告诉我强制执行 TLS 1.2 来解决问题。但我不知道如何在 nusoap 库中强制实施 TLS 1.2。

4

1 回答 1

1

看来您可以告诉 NuSOAP 使用 CURL。所以稍微修改设置应该可以解决问题

$client = new nusoap_client("https://www.eway.com.au/gateway/rebill/manageRebill.asmx");
$client->setUseCURL(true);
$client->setCurlOption(CURLOPT_SSLVERSION, '6'); // TLS 1.2

我没有办法对此进行测试,但我基于GitHub 中的 NuSOAP 类。这适用于 CURL,所以它应该在这里工作。

于 2017-10-30T12:37:08.300 回答