Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js Soap: invalid message definition for rpc style binding

Tags:

soap

wsdl

node.js

I'm trying to consume a wsdl from node. Using 'vpulim / node-soap'.

I can load the wsdl, describe it, and even invoke certain functions. However, any time I try to invoke a function that doesn't expect any arguments I get the error:

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)

Here is the 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] } } }

If I run the following code it works fine. I'll also include the soap request from 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>

So that function works fine because I'm able to pass an arg. However, the following code fails with the error above. You can see from the soapui request that there is no argument expected. It's just a function call that returns a list. I've tried settings blank args, null args, etc... can't get it to work.

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>

Any ideas of how I can get this to work?

like image 555
silver8ack Avatar asked Feb 25 '14 17:02

silver8ack


1 Answers

I was suffering with this for a while - I had success by defining args as 'null':

soap.createClient(url, function(err, client) {
    console.log(client.describe());
    client.getManagedModules(null, function(err, result) {
        console.log(result);
    });
});
like image 67
aroyalnit Avatar answered Oct 14 '22 23:10

aroyalnit