【发布时间】:2016-02-24 01:48:30
【问题描述】:
我在使用 node-soap npm 模块访问 SOAP Web 服务时遇到问题。
这是我正在尝试的:
var url = 'https://ws-uat.ewinerysolutions.com/2.00/EWSWebServices.asmx?wsdl';
soap.createClient(url, function(err, client) {
if(err) {
console.log(err);
}
console.log(client.describe());
}
这不会出错,但会记录一个空对象。检查client 显示返回的XML 被截断,这反过来会阻止node-soap 模块构建正确的客户端。 XML 的确切长度在 16348 字节的范围内波动。如果我移动 WSDL 以使其引用本地文件,则 client.describe() 将按预期执行,并且还可以调用 Web 服务。但是,对此类请求的较长响应也会以类似方式截断。这让我相信在收到所有数据块之前有什么东西正在关闭连接,所以我检查了request npm 模块(也与 node 一起打包)。
为了隔离问题,我尝试了retrieving the WSDL using only the request module:
var request = require('request');
var body = "";
request.get('https://ws-uat.ewinerysolutions.com/2.00/EWSWebServices.asmx?wsdl')
.on('data', function(data){
body += data;
}).on('end', function() {
console.log(body);
})
See a live version of this 返回截断的 XML 正文。
我之前曾使用这些相同的库进行过此操作,只是为了确保我已尝试使用一系列旧版本的依赖库运行相同的程序。
我对这些东西还是很陌生,所以任何帮助/指针将不胜感激!
【问题讨论】:
-
New open issue on the request module repo,因为当您使用节点版本 0.10.41 时不会出现此问题。
标签: xml node.js web-services soap request