Created
October 18, 2016 10:26
-
-
Save droganaida/e25acd79f11a5c6c2fb043ac7760abb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var Cookie = require('soap-cookie'); | |
exports.get = function(req, res){ | |
var url = 'http://ws.example.com/wsclientPath?wsdl'; | |
soap.createClient(url, function(err, client) { | |
if (err) { | |
res.send(err); | |
} else { | |
var args = { | |
customerID: yourID, | |
passphrase: "yourPassword", | |
}; | |
client.authenticate(args, function (err, response, headers) { | |
if (err){ | |
res.send(err); | |
} else { | |
var header = client.lastResponseHeaders; | |
client.setSecurity(new Cookie(header)); //authorizatoin | |
//any function here | |
res.send("connected!"); | |
}); | |
} | |
}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment