Skip to content

Instantly share code, notes, and snippets.

@droganaida
Created October 18, 2016 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save droganaida/e25acd79f11a5c6c2fb043ac7760abb0 to your computer and use it in GitHub Desktop.
Save droganaida/e25acd79f11a5c6c2fb043ac7760abb0 to your computer and use it in GitHub Desktop.
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