我试图使用node-soap连接到第三方web服务,但每当我使用web服务中的方法时,我都会得到一个巨大的对象,而不是正确的响应数据。
var soap = require('soap');
var soapWSDL = "https://staging.refcheckadvanced.co.za/RefCheck_Integrator/services/v2/RefCheck.svc?wsdl";
soap.createClient(soapWSDL, function (err, client) {
if (err) throw err;
client.IsHealthy({}, function(err,result) {
console.log(result);
});
});有人知道我做错了什么吗?
PHP SOAP信封:
<SOAP-ENV:Body>
<ns1:IsHealthy/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>Node-SOAP信封:
<soap:Body>
<tns:IsHealthy xmlns:tns="http://tempuri.org/" xmlns="http://tempuri.org/">
</tns:IsHealthy>
</soap:Body>
</soap:Envelope>有没有办法将node-soap配置为使用与PHP相同的格式?
发布于 2015-02-03 18:57:05
wsdl是动态生成的还是静态生成的?它对我来说是短暂的。
我的回答是:{ IsHealthyResult: '2015/02/03 11:56:48 AM' }
但是现在,当我尝试使用node-soap时,它会抛出一个错误(您不能处理)。
试试这个,你(也许)会看到err已经设置好了:
soap.createClient(soapWSDL, function (err, client) {
if (err) throw err;
client.IsHealthy({}, function(err,result) {
if (err) {
console.log(err.message);
} else {
console.log(result);
}
});
});返回:Cannot read property 'Body' of undefined
尝试使用node-inspector (跨平台)或NTVS (Windows + Visual Studio)进行调试
您将看到node-soap捕获了\lib\client.js:183中的异常并在回调中设置了错误。我不知道为什么它对我有短暂的效果。=P
但它提醒您始终在回调中检查err
https://stackoverflow.com/questions/28295938
复制相似问题