gpt4 book ai didi

ssl - strong-soap:通过 https 调用服务方法

转载 作者:行者123 更新时间:2023-12-04 04:01:05 24 4
gpt4 key购买 nike

我正在尝试使用 strong-soap node.js 库调用 SOAP 服务。虽然我确实将客户端安全性设置为 ClientSSLSecurity,但在客户端调用方法时出现错误:

TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"

如何让 stong-soap 使用 https?

到目前为止,这是我的代码:

"use strict";

var soap = require('strong-soap').soap;
var constants = require('constants');
var url = 'http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.wsdl';
var WSDL = soap.WSDL;
var options = {};
WSDL.open(url,options,
function(err, wsdl) {
if (err) {
console.log(err);
return;
}

var clientOptions = {
WSDL_CACHE : {
caqhcorewsdl: wsdl
}
};
soap.createClient('caqhcorewsdl', clientOptions, function(err, client) {
if (err) {
console.log(err);
return;
}
else {
client.setSecurity(new soap.ClientSSLSecurity(
'rob.keystore'
, 'cert.pem'
, {
strictSSL: true,
secureOptions: constants.SSL_OP_NO_TLSv1_2
}
));
if(err) {
console.error(err);
return;
}
else {
console.log('success!');
client.RealTimeTransaction({name: 'value'}, function(err, result, envelope, soapHeader) {
if(err) {
// ERROR IS THROWN HERE:
console.error(err);
return;
}
else {
console.log('success!');
}
});
}
}
});
});

谢谢!

罗布

最佳答案

将以下行替换为这一行:

var url = 'https://www.caqh.org/SOAP/WSDL/CORERule2.2.0.wsdl';

关于ssl - strong-soap:通过 https 调用服务方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63055837/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com