节点肥皂,使用受密码保护的 WSDL [英] Node soap, consume password protected WSDL

查看:29
本文介绍了节点肥皂,使用受密码保护的 WSDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Node 构建 SOAP 客户端,我使用的是soap"包(https://www.npmjs.org/package/soap) 尝试使用受用户/密码保护的 WSDL.

I'm trying to build a SOAP client with Node, I'm using "soap" package (https://www.npmjs.org/package/soap) trying to consume a user/password protected WSDL.

在通过soap.createClient"创建客户端之前,我找不到如何传递这些凭据,当然,如果我不提供正确的凭据,我将无法检索 WSDL.

I can't find how to pass those credentials before creating the client by "soap.createClient", and of course, I can't retrieve the WSDL if I don't provide the right credentials.

我尝试过:

soap.security.WSSecurity('user', 'pass');

soap.security.WSSecurity('user', 'pass');

然后调用createClient"但无济于事.

and then calling "createClient" but to no avail.

另外,我尝试用 node-soap-client 来做,这个客户端我(显然)可以连接到 WSDL,但在那之后,我不知道去哪里(如何调用方法).

Also, I've tried to do it with the node-soap-client, with this client I (apparently) can connect to the WSDL, but after that, I've no idea where to go (how to invoke methods).

我做错了什么?

感谢您的帮助!

推荐答案

用户名和密码凭据可以这样传递:

Username and password credentials can be passed like this:

var soap = require('soap');
var url = 'your WSDL url';
var auth = "Basic " + new Buffer("your username" + ":" + "your password").toString("base64");

soap.createClient(url, { wsdl_headers: {Authorization: auth} }, function(err, client) {
});

(源自 https://github.com/vpulim/node-soap/issues/56,谢谢Gabriel Lucena https://github.com/glucena一>)

(derived from https://github.com/vpulim/node-soap/issues/56, thank you Gabriel Lucena https://github.com/glucena)

这篇关于节点肥皂,使用受密码保护的 WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆