Node.js 节点soap客户端SSLSecuritypFX-403禁止
我正在尝试使用连接到SOAP服务,但得到Node.js 节点soap客户端SSLSecuritypFX-403禁止,node.js,soap-client,http-status-code-403,pfx,node-soap,Node.js,Soap Client,Http Status Code 403,Pfx,Node Soap,我正在尝试使用连接到SOAP服务,但得到403-禁止 我有一个pfx文件和密码,我正在尝试: var pfx = fs.readFileSync(path.join(__dirname, 'folder', 'my.pfx')); // pfx file is in the relative path './folder/my.pfx' var password = 'mypassword'; var options = { strictSSL: true, rejectUnauthor
403-禁止
我有一个pfx文件和密码,我正在尝试:
var pfx = fs.readFileSync(path.join(__dirname, 'folder', 'my.pfx')); // pfx file is in the relative path './folder/my.pfx'
var password = 'mypassword';
var options = {
strictSSL: true,
rejectUnauthorized: false,
hostname: myUrl,
forever: true
};
var security = new soap.ClientSSLSecurityPFX(pfx, password, options);
var url = 'https://theservice.com/ApplicationService.svc?singleWsdl';
soap.createClient(url, function (err, client) {
console.log(err);
console.log(client);
client.setSecurity(security);
});
但我得到403:
[Error: Invalid WSDL URL: https://theservice.com/ApplicationService.svc?singleWsdl
Code: 403
Response Body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>403 - Forbidden: Access is denied.</title>...
client.setSecurity(security);
^
TypeError: Cannot read property 'setSecurity' of undefined
[错误:无效的WSDL URL:https://theservice.com/ApplicationService.svc?singleWsdl
代码:403
响应主体:403-禁止:访问被拒绝。。。。
客户。设置安全性(安全性);
^
TypeError:无法读取未定义的属性“setSecurity”
我可以通过在MacOS的钥匙链上安装pfx,通过浏览器访问该服务。所以URL、pfx、密码等应该可以
关于可能出现的问题以及如何调试有什么想法吗?谢谢!我通过将pfx和密码短语设置为选项来连接。wsdl\u选项
:
var options = {
wsdl_options: {
forever: true,
rejectUnauthorized: false,
strictSSL: false,
pfx: fs.readFileSync(__dirname + '/folder/my.pfx'),
passphrase: 'myPass'
}
};
soap.createClient(myUrl, options, function (err, client) {
console.log(err);
console.log(client);
});
通过这种方式,它们可以使用HTTP选项并启用与客户端证书的连接。我通过将pfx和密码短语设置为选项来实现连接。wsdl_选项
:
var options = {
wsdl_options: {
forever: true,
rejectUnauthorized: false,
strictSSL: false,
pfx: fs.readFileSync(__dirname + '/folder/my.pfx'),
passphrase: 'myPass'
}
};
soap.createClient(myUrl, options, function (err, client) {
console.log(err);
console.log(client);
});
这样,他们就可以使用HTTP选项并启用与客户端证书的连接。在我的情况下,除了@moose的答案之外,我还必须这样做,也许这会帮助某些人(使用他们的示例):
var选项={
wsdl\u选项:{
永远:真的,
拒绝:错误,
对:错,,
pfx:fs.readFileSync(_dirname+'/folder/my.pfx'),
密码短语:“myPass”
}
};
createClient(myUrl、选项、函数(err、client){
client.setSecurity(new soap.ClientSSLSecurityPFX(pfx,pfxPass));//在我的情况下,除了@moose的答案之外,我还必须这样做,也许这会帮助某些人(使用他们的示例):
var选项={
wsdl\u选项:{
永远:真的,
拒绝:错误,
对:错,,
pfx:fs.readFileSync(_dirname+'/folder/my.pfx'),
密码短语:“myPass”
}
};
createClient(myUrl、选项、函数(err、client){
client.setSecurity(新的soap.ClientSSLSecurityPFX(pfx,pfxPass))//