title: soap client - server communication in Nodejs
body: <p>I am using Strong- soap npm package <a href="https://www.npmjs.com/package/strong-soap" rel="nofollow noreferrer">here</a> to make soap client-server communication in Nodejs. I am dealing with Arango database using AQL queries. I ma trying to get the result and display it in the server port.</p>
  
  <p>As a first step, I have created a soap client file and server file with examples available in npm package. I am not sure what am I doing wrong here ?</p>
  
  <p><strong>User.js</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// ##soap.listen
  var another = require('./authen.js');
  var soap = require('strong-soap').soap;
  var http = require('http');
  
   var myService = {
        MyService: {
            MyPort: {
                check_username: function(args) {
  
            res.header("Access-Control-Allow-Origin", "*");
            res.header("Access-Control-Allow-Headers", "X-Requested-With");
  
      db.query(aqlQuery`
       LET startVertex = (FOR doc IN spec
       FILTER doc.serial_no == '"123456abcde"'
       LIMIT 2
       RETURN doc
      )[0]
  
     FOR v IN 1 ANY startVertex belongs_to
     RETURN v.ip`,
     {
      bindVar1: 'value',
      bindVar2: 'value',
    }
    )
      }
     }
    }
   };
  
    var xml = require('fs').readFileSync('myservice.wsdl', 'utf8'),
        server = http.createServer(function(request,response) {
            response.end("404: Not Found: " + request.url);
        });
  
    server.listen(8000);
    soap.listen(server, '/wsdl', myService, xml);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Then I have created my client side file along with the wsdl file which I have shared below. Once I run both my server and client file. I am getting a error that doesn't recogonize by function. I getting a feeling that I am doing somethin wrong.Or am I doing it in a right way ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"use strict";
  
  var soap = require('strong-soap').soap;
  
  var url = 'http://192.00.00.000/test/myservice.wsdl';
  
  var requestArgs = {
    symbol: 'IBM'
  };
  
  var options = {};
  
    soap.createClient(url, options, function(err, client) {
  
    var method = client['check_username'];
  
    method(requestArgs, function(err, result, envelope, soapHeader) {
  
      console.log('Response Envelope: \n' + envelope);
      console.log('Result: \n' + JSON.stringify(result));
  
  });
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Error:</strong></p>
  
  <ul>
  <li>var method = client['check_username'];</li>
  <li>TypeError: Cannot read property 'check_username' of undefined</li>
  </ul>