1

我正在使用 node-soap 模块,它允许您使用 SOAP 连接到 Web 服务。我已经通过 SoapUI 测试了与 Soap-Server(Web 服务)的通信,效果很好。

目前我可以显示方法的输入数据。在这个例子中,我想找出方法 Connection 的输入数据。我可以用这个命令来识别它:client.describe().MachineWebService.MachineBinding.Connection

我的客户端代码如下所示:

var soap = require('soap');
var url = './MachineWebService.wsdl';

 // var args ={name: 'value'}

 soap.createClient(url, function(err, client) {
 console.log(client.describe().MachineWebService.MachineBinding.Connection);
//client.Connection(args, function(err, result) {
//  console.log(result);

}); 

我的客户端代码的结果是:

{ input:
   { loginInformation:
       subElement {
         nsName: 'xsd:complexType',
         prefix: 'tns',
         name: 'complexType',
         children: [Object],
         xmlns: 'http://www.XXXX.com/web-service/1.0',
         valueKey: '$value',
         xmlKey: '$xml',
         ignoredNamespaces: [Object],
         '$name': 'LoginInformationType' } },
  output:
   { result:
       subElement {
         nsName: 'xsd:complexType',
         prefix: 'tns',
         name: 'complexType',
         children: [Object],
         xmlns: 'http://www.XXXX.com/web-service/1.0',
         valueKey: '$value',
         xmlKey: '$xml',
         ignoredNamespaces: [Object],
         '$name': 'LoginInformationResponseType' },
     errors:
       subElement {
         nsName: 'xsd:complexType',
         prefix: 'tns',
         name: 'complexType',
         children: [Object],
         xmlns: 'http://www.XXXX.com/web-service/1.0',
         valueKey: '$value',
         xmlKey: '$xml',
         ignoredNamespaces: [Object],
         '$name': 'ErrorResponseType' } } }

问题: 实际上可以借助输入数据轻松识别参数。但是我的输入数据看起来很乱。我不明白如何使用上述输入数据构造参数。任何想法?

4

0 回答 0