A small tweak to existing answers: you can use your security object to create a header and to request a WSDL, for example:
const security = new soap.BasicAuthSecurity(username, password); const wsdl_headers = {}; security.addHeaders(wsdl_headers); soap.createClientAsync(url, { wsdl_headers }).then((err, client) => { client.setSecurity(security);
Or, if you are using something more complex than BasicAuthSecurity, you might also need to set wsdl_options from a security object, for example
const security = new soap.NTLMSecurity(username, password, domain, workstation); const wsdl_headers = {}, wsdl_options = {}; security.addHeaders(wsdl_headers); security.addOptions(wsdl_options); soap.createClientAsync(url, { wsdl_headers, wsdl_options }).then((err, client) => { client.setSecurity(security);
Rup
source share