title: NodeJS SOAP client request with certificate
body: <p>I'm trying to connect to a SOAP service which requires a certificate on my NodeJS project.
  I'm using <a href="https://www.npmjs.com/package/soap" rel="nofollow noreferrer">soap</a> and this is how I'm trying to access to it:</p>
  
  <pre><code>const soap = require('soap');
  (...)
  
  let sslOptions = {
      key: fs.readFileSync(keyPath),
      cert: fs.readFileSync(certPath)
  };
  let sslHeaders = {
      Authorization: {
          user: 'Z100079',
          pass: password
      }
  };
  Service.GetLossRatio = function (contractID, start, end, asOf, cb) {
      process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
      let args = {
          contractID: contractID,
          start: start,
          end: end,
          asOf: asOf
      };
      soap.createClientAsync(url,
          {
              //request : specialRequest,
              wsdl_options: sslOptions,
              wsdl_headers: sslHeaders
          })
          .then((client) =&gt; {
              client.setSecurity(
                  new soap.ClientSSLSecurityPFX(
                      certCerPath
                  )
          );
          client.LossratioService.LossratioPort.calculate(args, (err, res) =&gt; {
              if (err) {
                  console.log(err);
                  return cb(err);
              }
              console.log(res);
              return cb(null, res);
          });
      })
      .catch((e) =&gt; {
          console.log(e);
          cb(e);
      });
  };
  </code></pre>
  
  <p>And I'm getting a "Wrong Tag" Error when the LossratioPort.calculate() occurs.
  I've no idea what that error means, I can't find much documentation about this specific situation, the "soap" documentation only show a brief explenation on how to make a request with certificates but there's not much more</p>
  
  <p>I know the certificates are valid and I've tried with all the generated certificates from the .pem file (.p12, and .cer). I just want to be sure I'm getting something from the service. Either what I really want, or an error <strong>from the server</strong>, not from the api.</p>
  
  <p>Any help?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I'm able to get the service description thorugh client.describe() though:</p>
  
  <p>{"LossratioService":{"LossratioPort":{"calculate":{"input":"tns:calculate","output":"tns:calculateResponse"},"ping":{"input":"tns:ping","output":"tns:pingResponse"},"shakedownTest":{"input":"tns:shakedownTest","output":"tns:shakedownTestResponse"}}}}</p>
  
  <p>I've also confirmed the inputs, and I'm sending as the service requires.</p>