title: Send a SOAP request with WSSecurity in NodeJS
body: <p>I'm trying to request this internal service that the team responsible for it said it needs both an Username + Password AND to be encrypted with a certificate.</p>
  
  <p>I thought of using this module <code>node-soap</code> and I found this in the documentation:</p>
  
  <p>1- <a href="https://github.com/vpulim/node-soap#wssecurity" rel="nofollow noreferrer">https://github.com/vpulim/node-soap#wssecurity</a></p>
  
  <p>2- <a href="https://github.com/vpulim/node-soap#wssecuritycert" rel="nofollow noreferrer">https://github.com/vpulim/node-soap#wssecuritycert</a></p>
  
  <p>It explains how to implement WSSecurity, but one rule overwrites the other. So this code won't work:</p>
  
  <pre><code>var wsSecurity = new soap.WSSecurity('username', 'password', options)
  client.setSecurity(wsSecurity);
  
  var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password);
  client.setSecurity(wsSecurity);
  </code></pre>
  
  <p>What is the proper way of using both strategies?</p>
  
  <p>I'm a newbie on SOAP, any help would be very appreciated </p>