【问题标题】:Node.js Soap: invalid message definition for rpc style bindingNode.js Soap:rpc 样式绑定的无效消息定义
【发布时间】:2014-02-25 17:40:25
【问题描述】:

我正在尝试使用来自节点的 wsdl。使用'vpulim / node-soap'。

我可以加载 wsdl,对其进行描述,甚至调用某些函数。但是,每当我尝试调用一个不需要任何参数的函数时,我都会收到错误:

assert.js:92
  throw new assert.AssertionError({
        ^
AssertionError: invalid message definition for rpc style binding
    at Client._invoke (/home/user/node_scripts/application/node_modules/soap/lib/client.js:126:12)
    at null.getManagedModules (/home/user/node_scripts/application/node_modules/soap/lib/client.js:87:10)
    at /home/user/node_scripts/application/client.js:9:12
    at /home/user/node_scripts/application/node_modules/soap/lib/soap.js:48:5
    at null.callback (/home/user/node_scripts/application/node_modules/soap/lib/soap.js:35:7)
    at /home/user/node_scripts/application/node_modules/soap/lib/wsdl.js:716:12
    at WSDL._processNextInclude (/home/user/node_scripts/application/node_modules/soap/lib/wsdl.js:732:12)
    at WSDL.processIncludes (/home/user/node_scripts/application/node_modules/soap/lib/wsdl.js:762:8)
    at /home/user/node_scripts/application/node_modules/soap/lib/wsdl.js:678:10
    at process._tickCallback (node.js:415:13)

这里是describe():

{ AlertPollingService:
   { AlertPollingService:
      { getManagementModule: [Object],
        getEMConfig: [Object],
        getAlertSnapshot: [Object],
        getAlertSnapshots: [Object],
        getManagedModules: [Object],
        getAllIscopeManagmentModules: [Object],
        getAllFilteredIscopeManagmentModules: [Object],
        getAllAlertsSnapshot: [Object],
        getAllAlertsSnapshotForManagementModule: [Object],
        getAgentSnapshot: [Object],
        getAgentSnapshots: [Object] } } }

如果我运行以下代码,它可以正常工作。我还将包括来自 SoapUI 的肥皂请求:

var args = {manModuleName: 'MQ'}
soap.createClient(url, function(err, client) {
    console.log(client.describe());
    client.getManagementModule(args, function(err, result) {
        console.log(result);
    });
});

### SOAPUI REQUEST ###
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aler="http://alerts.hidden.server.hidden.com">
   <soapenv:Header/>
   <soapenv:Body>
      <aler:getManagementModule soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <manModuleName xsi:type="xsd:string">MQ</manModuleName>
      </aler:getManagementModule>
   </soapenv:Body>
</soapenv:Envelope>

所以该函数可以正常工作,因为我能够传递一个 arg。但是,以下代码因上述错误而失败。您可以从 soapui 请求中看到没有预期的参数。它只是一个返回列表的函数调用。我试过设置空白参数、空参数等...无法正常工作。

soap.createClient(url, function(err, client) {
    console.log(client.describe());
    client.getManagedModules(function(err, result) {
        console.log(result);
    });
});

### SOAPUI REQUEST ###
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aler="http://alerts.hidden.server.hidden.com">
   <soapenv:Header/>
   <soapenv:Body>
      <aler:getManagedModules soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   </soapenv:Body>
</soapenv:Envelope>

关于如何让它发挥作用的任何想法?

【问题讨论】:

    标签: node.js soap wsdl


    【解决方案1】:

    我为此受苦了一段时间 - 我通过将 args 定义为“null”取得了成功:

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

    【讨论】:

    • 有什么解决办法吗?我需要传递参数和方法也期望参数。所以,不能传null。
    • 谢谢@aroyalnit - 我遇到了同样的挑战。
    猜你喜欢
    • 2020-03-10
    • 1970-01-01
    • 2017-10-30
    • 2012-12-02
    • 1970-01-01
    • 2019-05-14
    • 1970-01-01
    • 2016-11-25
    • 1970-01-01
    相关资源
    最近更新 更多