Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function testsoap() {
var soap = require('soap');
soap.createClient(gSkopeiURL, function(err, client) {
// var info = client.describe();
// var args = {Text: 'hahahoho'};
// add_authentication(args);
// client.TestWebservice(args, function(err, result) {
// if(err) {
// log_line('TestWebservice - error ' + err);
// } else {
// log_line(result);
// }
// });
var args = { ElockID: "170178"}; // , PeriodTill: '2017-04-30T23:59:59Z'}
add_authentication(args);
let soapClient: soap.Client = await new Promise((resolve: (soapClient: soap.Client,) => any, reject) => {
soap.createClient(url, (err, client: soap.Client) => {
// console.log('callback', err)
// console.log('keys', _.keys(client))
if (err) reject(err)
else resolve(client)
})
})
TrackService.prototype.init = function init(callback) {
var self = this;
// Ignore self signed certificate error
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
soap.createClient(WSDL_PATH, {endpoint: ENDPOINT}, function(err, client) {
if (err) {
return callback(err);
}
updateSecurity(client);
updateToken(client);
var args = {
user: self.defaultArgs.user,
password: self.defaultArgs.password,
deviceType: self.defaultArgs.deviceType,
lastmessage: "",
lang: self.defaultArgs.lang
};
client.MessageBoardJson(args, function(err, res) {
sfClient.getIdentity({ oauth: oauth }, function(err, res) {
if(err) return cb(err);
soap.createClient(mdWsdl, function(err, client) {
if(err) return cb(err);
//client.setSecurity(new soap.BearerSecurity(oauth.access_token));
var header = {
'SessionHeader': {
'sessionId': oauth.access_token
}
};
var name = '';
var xmlns = 'http://soap.sforce.com/2006/04/metadata';
var ns = 'urn';
//
client.addSoapHeader(header, name, ns, xmlns);
// var header = [
// '',
this.connectionPromise = new Promise(function(resolve, reject) {
var url = self.server + '/ags/ws?wsdl';
console.log('Connecting to', url);
soap.createClient(url, function(e, cl) {
console.info('AccountGenerator: SOAP has been connected', e && e.message || '');
if (e) throw e;
self.client = cl;
resolve(self.client);
});
});
function (callback) {
//Authenticate with API
soap.createClient(url_login, options, function(err, client) {
client.login(args_login, function (err, result) {
if(err) callback(err);
callback(null, result.return);
});
});
},
function (security_obj, callback){
Client.prototype.createClient = function(callback) {
var that = this;
soap.createClient(url, function(err, client) {
if (err) return callback(err);
that.client = client;
return callback(null);
});
};
}, (err, resp, status) => {
if (err) {
console.log(err);
} else {
console.log('create', resp);
}
});
} else {
console.log('Index gls_parcelshop_dk, already exists')
}
})
let url = 'http://www.gls.dk/webservices_v2/wsPakkeshop.asmx?wsdl'
let bulk = []
soap.createClient(url, (err, client) => {
client.GetAllParcelShops({}, (err, result) => {
if (result.GetAllParcelShopsResult) {
for (let i = 0; i < result.GetAllParcelShopsResult.PakkeshopData.length; i++) {
let droppoint = result.GetAllParcelShopsResult.PakkeshopData[i]
bulk.push(
{
index: {
_index: 'gls_parcelshop_dk',
_type: 'droppoint',
_id: droppoint.Number
}
}
)
bulk.push(droppoint)
}
var authSoap = function(username, password, domain, url, cb) {
var args = {
username: username,
password: password,
domain: domain
};
soap.createClient(url, function(err, client) {
client.Logon(args, function(err, result) {
cb(result.LogonResult === '');
});
});
};
initialize(callback) {
if (!callback) {
return new Promise((resolve, reject) => {
this.initialize((error, res) => {
if (error) {
return reject(error);
}
return resolve(res);
});
});
}
return Soap.createClient(this.config.apiUrl, {
envelopeKey: 'x',
overrideRootElement: {
namespace: 'ns1',
},
wsdl_options: {
timeout: this.config.timeout,
},
}, (error, client) => {
if (error) {
return callback(error);
}
this.client = client;
return callback(null);
});
}