I am new to Node.js
technology and facing some issues in recursive concept.
I have a main.js which contains list of username and a soap method call Soap.js
contains soap method which will fetch email id from username.
------------- Main.js ----------------
'use strict'
var emailService = require('./emailService .js').emailService ;
var emailService1 = new emailService ();
var emailList = [];
var psList = ['1062','10465','10664','10681'];
emailService1.helpdeskEmailService(psList, 'abcabc', 'abcabc', function(err,result) {
console.log('in service -------------------------');
if (err) {
console.log("Error while api call :: " +err);
} else {
console.log("response from soap service - " + result);
}
});
console.log('my email list' +result);
------------- SoapService.js ----------------
'use strict'
var c_instancename = '';
var soap = require('soap');
var l_args;
var c_url = "http://airinmsbmcarmt.lntinfotech.com/arsys/WSDL/public/172.21.103.136/zlandt:FetchEmailID";
class emailService {
constructor(p_instanceName) {
c_instancename = p_instanceName;
}
helpdeskEmailService (ps_number,p_username,p_password,p_callback) {
var l_header = {
'authentication': '',
'locale': '',
'timeZone': '',
'AuthenticationInfo': {
'userName': p_username,
'password': p_password
}
}
soap.createClient(c_url, function(err, client) {
//var soapheader = l_header;
client.addSoapHeader(l_header);
var l_args = {LoginID:ps_number};
client.EmailID(l_args, function(err, result) {
if(err) {
console.log('error page');
} else {
console.log('my resultttttttt in soap...');
p_callback(err,result);
}
});
});
}
}
module.exports.emailService = emailService;
In this case, I'm getting late response from soap service.
Can I have sync call for webservice
because I am getting NULL
values for emailList.
I have a main.js
which contains list of username and a soap method call.
Soap.js
contains soap method which will fetch email id from username.