简单的SOAP调用失败(Nodejs,easysoap)

我在使用easysoap( https://npmjs.org/package/easysoap )时遇到了一些问题,而且我一直无法find很多文档或人们在讨论这个问题,所以我希望你们中的一些人可以帮忙:

我正在做一个这样简单的调用:

var clientParams = { host : 'somewhere.com', port : '9001', path : '/somews.asmx', wsdl : '/somews.asmx?WSDL' }; var clientOptions = { secure : false }; //create new soap client var SoapClient = new soap.Client(clientParams, clientOptions); SoapClient.once('initialized', function() { //successful initialized SoapClient.once('soapMethod', function(data, header) { }); console.log('call'); SoapClient.call({ 'method' : 'Execute', 'params' : { 'ExecuteXML' : 1 }}, function(attrs, err, responseArray, header){ } ); }); //initialize soap client SoapClient.init(); 

问题是我得到一个答复,说我没有被授权做出我的请求。但是,如果我手动尝试在浏览器http://somewhere.com:9001/somews.asmx相同的url,它的工作。

你知道我在做什么错吗?

许多人提前感谢。

如果你们有任何其他节点模块知道这一点,请让我知道。 我试图使用节点肥皂,但迷失在所有的依赖需要:python,Visual Studio …你真的需要所有这一切,使肥皂调用一个服务器?

谢谢

对于其他nodejs肥皂块。 我目前使用节点肥皂,我很高兴。 你可以在这里find项目。

这里是我如何使用它的一个例子。

 var soap = require('soap'); //example url var url = 'http://ws.strikeiron.com/GlobalAddressVerification5?WSDL'; var soapHeader = ''//xml string for header soap.createClient(url, function(err, client){ client.addSoapHeader(soapHeader); var args = { StreetAddressLines: "5322 Otter Lane", CountrySpecificLocalityLine: "Middleberge FL 32068", Country: "USA" }; client.BasicVerify(args, function(err, result){ if(err){ throw err; } console.log(result); }); }); 

对我来说,这工作:

  "use strict"; var easysoap = require('easysoap'); var clientParams = { host : 'http://somewhere.com:9001', path : '/somews.asmx', wsdl : '/somews.asmx?WSDL' }; var clientOptions = { secure : false }; var soapClient = easysoap.createClient(params, clientOptions); soapClient.call({'method' : 'Execute', 'params' : { 'ExecuteXML' : 1 }}) .then(function (callResponse) { console.log(callResponse); }) .catch(function (err) { console.log("Got an error making SOAP call: ", err); });