使用SOAP在NodeJS中抛出新的assert.AssertionError

时间:2015-05-11 13:25:18

标签: node.js web-services soap

我在我的nodeJs项目中使用SOAP模块来使用像客户端一样的soap web服务。这是我的档案:

var soap = require('soap');

this.getSoap = function (request, response) {
var url = 'http://rhoda.uci.cu/roa.php/interoperability/session?wsdl';
var args = {};

soap.createClient(url, function (err, client) {
    if (err) {
        console.log(err);
    } else {
        client.createAnonymousSession(args, function (err, result) {
            if (err) {
                console.log(err)
            } else {
                console.log(result)
            }
        });
    }
  });
};

createAnonymousSession 是Web服务中可用的函数,并返回一些匿名参数(例如:5550a505b5d86)。

当我执行获取此错误时:

assert.js:92

抛出新的assert.AssertionError({         ^   AssertionError:rpc样式绑定的消息定义无效     在Client._invoke(/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/client.js:183:12)     at null.createAnonymousSession(/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/client.js:129:10)     在/home/heimdall/Proyectos/myNODE/src/SoapModule/controller/soapController.js:23:20     at /home/heimdall/Proyectos/myNODE/node_modules/soap/lib/soap.js:49:5     at null.callback(/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/soap.js:36:7)     at /home/heimdall/Proyectos/myNODE/node_modules/soap/lib/wsdl.js:1056:12     在WSDL._processNextInclude(/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/wsdl.js:1098:12)     在WSDL.processIncludes(/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/wsdl.js:1131:8)     at /home/heimdall/Proyectos/myNODE/node_modules/soap/lib/wsdl.js:1011:10     at process._tickCallback(node.js:415:13)

1 个答案:

答案 0 :(得分:0)

我的解决方案:

var soap = require('soap');

this.getSoap = function (request, response) {
var url = 'http://rhoda.uci.cu/roa.php/interoperability/session?wsdl';

soap.createClient(url, function (err, client) {
    console.log(client.describe());
    client.createAnonymousSession(null, function (err, result) {
        if (err) {
            console.log(err)
        } else {
            console.log(result)
        }
    });
  });
};

当网络服务功能不需要args 时, null