title: How to pass Authentication Header to node-soap
body: <p>I am trying to use a wsdl service as a client  but I cannot find how to set some headers.</p>
  
  <p>The reason I need this is because the wsdl I am trying to use requires the username and password via the headers.
  this is wsdl</p>
  
  <pre><code>&gt;    POST /Service.asmx HTTP/1.1
  &gt;             Host: 210.12.155.16
  &gt;             Content-Type: text/xml; charset=utf-8
  &gt;             Content-Length: length
  &gt;             SOAPAction: "http://yyyy.com:1002/apability"
  &gt;             
  &gt;             &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &gt;             &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  &gt;         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  &gt;         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &gt;               &lt;soap:Header&gt;
  &gt;                 &lt;AuthHeader xmlns="http://yyyy.com:1002/"&gt;
  &gt;                   &lt;UserName&gt;string&lt;/UserName&gt;
  &gt;                   &lt;Password&gt;string&lt;/Password&gt;
  &gt;                 &lt;/AuthHeader&gt;
  &gt;               &lt;/soap:Header&gt;
  &gt;               &lt;soap:Body&gt;
  &gt;                 &lt;sale xmlns="http://yyyy.com:1002/"&gt;
  &gt;                   &lt;BID&gt;string&lt;/BID&gt;
  &gt;                   &lt;Amount&gt;string&lt;/Amount&gt;
  &gt;                   &lt;/sale&gt;
  &gt;               &lt;/soap:Body&gt;
  &gt;             &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>and this is code :</p>
  
  <pre><code>   var args={BID:"123",Amount : "10000"};
  
        var AuthHeader = {
                  "UserName" : user,
                  "Password" : pass
                  };
              soap.createClient(url,function(error,client){
              client.addSoapHeader(AuthHeader);   
  
                client.sale(args,function(error,result){
                console.log(error);
  
              });
  </code></pre>
  
  <p>i have to send authentication in header 
  but it doesn't work<br>
  i thing soapHeader's var is wrong .
  what would i do to solve authentication problem ?
  thanks a lot </p>