【问题标题】:How Can I enforce TLS 1.2 when using nusoap?使用 nusoap 时如何强制执行 TLS 1.2?
【发布时间】:2017-10-27 12:28:23
【问题描述】:

我正在使用 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->响应具有响应的内容)

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

【问题讨论】:

  • @machavity -- 这不是重复的问题。我在 nusoap 遇到问题。旧问题和解决方案在肥皂中
  • 嗯。显然不是。奇怪的是提问者说 NuSOAP 然后使用 PHP SOAP。无论如何,深入研究这个我找到了一个明显的答案

标签: php soap tls1.2 nusoap eway


【解决方案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

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

【讨论】:

    猜你喜欢
    • 2018-12-10
    • 2021-12-20
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 2014-12-21
    • 2018-03-08
    • 2015-12-11
    • 2020-06-09
    相关资源
    最近更新 更多