Raf*_*nte 5 soap soap-client node.js
我在使用easysoap时遇到了一些问题(https://npmjs.org/package/easysoap),我一直无法找到太多的文档或人们谈论它,所以我希望你们中的一些人可以提供帮助:
我正在做一个这样简单的电话:
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();
Run Code Online (Sandbox Code Playgroud)
问题是我收到回复说我无权提出我的请求.但是如果我在浏览器http://somewhere.com:9001/somews.asmx中手动尝试相同的URL 它确实有效.
你知道我做错了什么吗?
许多人提前感谢.
如果您有任何其他节点模块知道这一点,请告诉我.我尝试使用node-soap,但在所有需要的依赖项中丢失了:python,Visual Studio ......你真的需要所有这些来对服务器进行几次soap调用吗???
谢谢
小智 5
对于其他nodejs soap模块.我目前使用node-soap并对此感到满意.你可以在这里找到这个项目.
这是我如何使用它的一个例子.
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);
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9286 次 |
| 最近记录: |