我正在尝试从节点使用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请求中看到预期没有参数。它只是一个返回列表的函数调用。我已经尝试过设置空白args,null args等等......无法让它工作。
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>
关于如何让它发挥作用的任何想法?