title: Making and using NodeJS's soap client synchronous
body: <p>A using NodeJs's current soap client to call a soap service function whenever i send an HTTP request to the server.</p>
  
  <p>The Problem is that the request returns before the soap service call finishes, thus returning no data. </p>
  
  <p>The issues here is that the logic is asynchronous yet i need to make it synchronous. </p>
  
  <p>Please kindly direct me to the right solution.</p>
  
  <pre><code>function soap_get_items(req,res){
      var resp = [];
  
      var soap = require('soap');
      var url = 'http://example.com/example.wsd?singleWsdl';
      var args = {name:"N.Hillary"};
  
      soap.createClient(url, function(err, client) {
          client.exampleSoapFunction(args, function(err, result) {
              resp = result;
          });
      });
  
      json_resp = JSON.stringify(resp);
      res.end(json_resp);
  }
  </code></pre>