title: How can invoke SOAP webservice in node js with NTLM authentication
body: <p>I'm a newbie in NodeJS, and I need some help to connect to a SOAP Webservice which is on NTLM authentication.  </p>
  
  <p>When executing this code, an error appears in httpntlm module:</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>C:\soapclient\node_modules\httpntlm\ntlm.js:106
  
  callback(new Error("Couldn't find NTLM in the message type2 comming from the server"));
                  ^
  TypeError: callback is not a function
      at Object.parseType2Message 
  (C:\soapclient\node_modules\httpntlm\ntlm.js:106:3)
      at sendType3Message 
  (C:\soapclient\node_modules\httpntlm\httpntlm.js:66:23)
      at Immediate._onImmediate (C:\soapclient\node_modules\httpntlm\httpntlm.js:93:4)
      at processImmediate [as _immediateCallback] (timers.js:383:17)</code></pre>
  </div>
  </div>
  </p>
  
  
  
  <p>and the code :</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>var soap = require('soap-ntlm-2');
  var url ='https://ws.tmb.cat/secure/ws-ibus/IBusService?WSDL'
  
  var options = {
  wsdl_options: {
      ntlm: true,
      username: "xxxxxx",
      password: "xxxxxx"
  
  }
  };
  
  soap.createClient(url, options, function (err, client, body) {
   
  if (err) {
      console.log("4")
      console.log(err);
  }    
  client.setSecurity(new soap.NtlmSecurity(options.wsdl_options));
   
  console.log(client.describe());
  report = client.getAllArrivaltimes({}, function(err, res){
             console.log('err='+err);
             console.log('res='+res);
  });
  
  });
     </code></pre>
  </div>
  </div>
  </p>