【问题标题】:throw new assert.AssertionError in NodeJS with SOAP使用 SOAP 在 NodeJS 中抛出新的 assert.AssertionError
【发布时间】:2015-05-11 13:25:18
【问题描述】:

我在我的 nodeJs 项目中使用 SOAP 模块来使用像客户端一样的肥皂网络服务。这是我的文件:

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 是网络服务中可用的函数,并返回一些匿名会话(例如:5550a505b5d86)。

当我执行得到这个错误:

assert.js:92

抛出新的 assert.AssertionError({ ^ AssertionError:rpc 样式绑定的无效消息定义 在 Client._invoke (/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/client.js:183:12) 在 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 在/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/soap.js:49:5 在 null.callback (/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/soap.js:36:7) 在/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) 在/home/heimdall/Proyectos/myNODE/node_modules/soap/lib/wsdl.js:1011:10 在 process._tickCallback (node.js:415:13)

【问题讨论】:

    标签: node.js web-services soap


    【解决方案1】:

    我的解决方案:

    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)
            }
        });
      });
    };
    

    当网络服务函数不需要参数时,则为null

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-28
      • 1970-01-01
      • 2017-07-29
      • 1970-01-01
      • 2020-08-13
      • 2016-12-23
      • 2012-03-20
      • 1970-01-01
      相关资源
      最近更新 更多