在NodeJS中使用WSSecurity发送SOAP请求

问题描述 投票:0回答:1

我正在尝试请求这个内部服务,负责它的团队说它需要一个用户名+密码和用证书加密。

我想使用这个模块node-soap,我在文档中找到了这个:

1- https://github.com/vpulim/node-soap#wssecurity

2- https://github.com/vpulim/node-soap#wssecuritycert

它解释了如何实现WSSecurity,但是一条规则会覆盖另一条规则。所以这段代码不起作用:

var wsSecurity = new soap.WSSecurity('username', 'password', options)
client.setSecurity(wsSecurity);

var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password);
client.setSecurity(wsSecurity);

使用这两种策略的正确方法是什么?

我是SOAP的新手,任何帮助都将非常感激

node.js soap wsdl ws-security
1个回答
0
投票

我遇到了同样的要求。我正在构建一个自定义的WSSecurityCertSSL安全模块,它不是很好,但可能只是工作。最好的办法是修改node-soap,这样你就可以堆叠多个证券,因为有些证券(即:ssl)只处理连接而其他人处理包络操作(即:WssSecurity)。

© www.soinside.com 2019 - 2024. All rights reserved.