larrytron larrytron - 1 year ago 220
Node.js Question

How can invoke SOAP webservice in node js with NTLM authentication

I'm a newbie in NodeJS, and I need some help to connect to a SOAP Webservice which is on NTLM authentication.

When executing this code, an error appears in httpntlm module:


callback(new Error("Couldn't find NTLM in the message type2 comming from the server"));
TypeError: callback is not a function
at Object.parseType2Message
at sendType3Message
at Immediate._onImmediate (C:\soapclient\node_modules\httpntlm\httpntlm.js:93:4)
at processImmediate [as _immediateCallback] (timers.js:383:17)

and the code :

var soap = require('soap-ntlm-2');
var url =''

var options = {
wsdl_options: {
ntlm: true,
username: "xxxxxx",
password: "xxxxxx"


soap.createClient(url, options, function (err, client, body) {

if (err) {
client.setSecurity(new soap.NtlmSecurity(options.wsdl_options));

report = client.getAllArrivaltimes({}, function(err, res){


Answer Source

This is a bug in http-ntlm module.
It does not pass the callback, so it's undefined when it is called.

Here is the related bug on GitHub:

And here is the fix for this problem:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download