ssl - strong-soap:通过 https 调用服务方法
问题描述
我正在尝试使用 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!');
}
});
}
}
});
});
谢谢!
抢G
解决方案
用这一行替换以下行:
var url = 'https://www.caqh.org/SOAP/WSDL/CORERule2.2.0.wsdl';
推荐阅读
- node.js - 将 HTTP 主体从一个函数传递到另一个 nodeJS
- kubernetes - kubectl config 合并重定向不像预期的那样
- cmd - WScript.CreateObject("WScript.Shell") 在 win8 的 cmd 中无法识别
- c++ - 二叉树中节点的级别
- typescript - 能够从不相关的类型生成 TypeScript 元组?
- elixir - 如何在 Phoenix Form 中传递具有 put_assoc 的变更集
- python - 在 Python 中使用 numpy.random.choice 的更快替代方案?
- php - 如何更改特殊格式的媒体 url 结构
- java - 使用 Collections.sort() 对 ArrayList 进行复杂排序?
- c# - Unity3D蓝牙串行馈送分配器问题C#