小编moo*_*ses的帖子

Node soap ClientSSLSecurityPFX - 403 Forbidden

我正在尝试使用node-soap连接到 SOAP 服务,但获取403 - Forbidden.

我有一个 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);
});
Run Code Online (Sandbox Code Playgroud)

但我得到 403:

[Error: Invalid WSDL URL: https://theservice.com/ApplicationService.svc?singleWsdl

 Code: 403

 Response Body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML …
Run Code Online (Sandbox Code Playgroud)

soap-client pfx node.js http-status-code-403 node-soap

0
推荐指数
1
解决办法
1212
查看次数