0

我必须制作服务器来更新某些设备。
他们让我使用 node.js 并且设备发送一个肥皂请求。我需要检查参数以验证版本。所以我决定使用 node-soap 模块。(我使用的 WSDL 文件是本地文件)
但是我找不到如何恢复这些参数的值。我阅读了 node-soap 规范,但我找不到如何做到这一点。:/
这是我的代码(我还没有做太多,因为我因此被卡住了):

var myService = {
    ActiaProxyAPI: { //MyService
        ActiaProxyAPI: { //MyPort
              GetData: function(args) { //MyFunction
                    if (args.i-uiType == "11") {
                        var ID = args.i-pcIdentifiant;
                        var reg=new RegExp("[ $]+", "g"); //parse the string (actually works)
                        var tableau=ID.split(reg); 
                        console.log(tableau[4] );
                      }
                  return {
                      name: args.o-poData 
                  };
              }

          }
      }
  };

  var xml = require('fs').readFileSync('./wsdl/ActiaProxyAPI.wsdl', 'utf8'),
      server = http.createServer(function(request,response) {
          response.end("404: Not Found: "+request.url);
      });

  server.listen(8080);
  soap.listen(server, '/wsdl', myService, xml);
4

1 回答 1

0

我找到了如何检索参数的值:我使用args["i-uiType"]而不是args.i -uiType ,而不是name: args.o-poData : 'tns:GetDataResponse': {'o -poData':结果}

好吧,我希望这可以帮助其他人,因为它对我有用!

于 2013-07-31T07:55:32.790 回答