how to set headers using node-soap in node.js
express, node.js, soap
Solution
It may not be useful now however inorder to answering this question which is still open, here it goes.
You can make use of the method Client.addSoapHeader. As per the documentation
Client.addSoapHeader(soapHeader[, name, namespace, xmlns]) - add soapHeader to soap:Header node
Options
soapHeader Object({rootName: {name: "value"}}) or strict xml-string Optional parameters when first arg is object :
name Unknown parameter (it could just a empty string)
namespace prefix of xml namespace
xmlns URI
So you need to create an object and pass that to this method like:
var soapHeader = {
"Username": "foo",
"Password" : "bar"
};
client.addSoapHeader(soapHeader);
Problem
I am trying to consume a wsdl service and found node-soap, but I cannot find how to set some headers. Example : ``` header = { "Username": "foo", "Password" : "bar" } ``` The reason I need this is because the wsdl I am trying to consume requires the username and password via the headers. Thanks in advance