title: How to create a SSL SOAP Client in Nodejs
body: <p><em>First of all, I'd like to make it clear this is my very first time dealing with certificates/keys/pfx/etc.. so please correct me if I'm wrong :)</em></p>
  <p>I'm using <a href="https://github.com/vpulim/node-soap" rel="nofollow noreferrer"><code>node-soap</code></a> to create a client to a web-server and consume its' WSDL. Doing so only on <code>HTTP</code> protocol and not <code>HTTPS</code> i had success and everything worked just fine, but now with the <code>pfx</code> I get the <code>mac verify failure</code> error.</p>
  <p>the relevant code:</p>
  <pre><code>import * as soap from 'soap';
  import * as fs from 'fs';
  
  let client_options: {
      forceSoap12Headers: true,
      wsdl_options:{
        pfx: fs.readFileSync('PATH\TO\MY\PFX')
      }
  };
  
  soap.createClient('HTTPS\WEB-SERVER\URL?wsdl', client_options, (error, client)=&gt;{
      console.log(error.message) // &lt;-- mac verify failure
      console.log(client) // &lt;-- undefined
  });
  </code></pre>
  <p><em><strong>Worth noting:</strong></em></p>
  <ul>
  <li><p>I could not find any documentation of the <code>node-soap</code> library for the -- <code>wsdl_options</code> property, the <code>pfx</code> one i accidently found while googling so i dont know any other options available.</p>
  </li>
  <li><p>Trying to deal with this error, i found that an option of <code>passphrase: 'password'</code> should be added to options BUT for options of <code>createServer</code> with the <code>https</code> library, not for creating a client with <code>node-soap</code>..  relevant links: <a href="https://stackoverflow.com/questions/22859121/mac-verify-failure-using-node-with-ssl-certificate">stackoverflow question</a> , <a href="https://github.com/nodejs/node-v0.x-archive/issues/7407" rel="nofollow noreferrer">git issue</a></p>
  </li>
  </ul>
  <p>I've been dealing with this for the past 3 days, got to debugging all <code>node-soap</code>, <code>https</code>, and <code>request</code> libraries.. got lost in there.</p>
  <p>Any help or suggestions would be much appreciated, thanks in advance!</p>