强soap:通过https调用服务方法



我正在尝试使用强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!');
}
});
}
}
});
});

谢谢!

Rob G

用以下行替换:

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

最新更新