1

See below for TL;DR!

Having trouble consuming a WSDL with node-soap. I've tried with other WSDLs (examples found online) and they work just fine - with this particular one, however, I run in to a myriad of problems. I'm using soap-as-promised, which uses the node-soap module. It should be irrelevant.

var soap = require('soap-as-promised');
var url = 'https://test.ipg-online.com/ipgapi/services/order.wsdl';

var apiCall = exports.apiCall = function () {
        console.error("test");
        soap.createClient(url, { wsdl_options: { cert: '/path/to/cert.pem', key:'/path/to/key.key' } } )
        .then(function(client) {
            console.error(client);
            client.describe();
        })
        .catch(function(error) {
            console.error(error);
        });

    }

This is the code I'm using now, but this definitely isn't right. It returns the following error (the paths to my cert and private key are correct):

[Error: error:0906D06C:PEM routines:PEM_read_bio:no start line]

It seems, based on the docs, that I'm supposed to be using client.setSecurity for SSL communications:

    client.setSecurity(new soap.ClientSSLSecurity(
    '/path/to/key'
    , '/path/to/cert'
    , {/*default request options*/}
  ));

However, if I do just that, and ignore the wsdl_options, client is returned as undefined in the callback, not allowing me to run any functions, including the setSecurity functiion. I assume it has to be a combination of the both, but I'm lost as to what combination.

TL;DR Trying to consume WSDL with node-soap; this WSDL requires a certificate and a private key, as well as authentication with a username/pw. What's the process for doing this with node-soap? Do I have to install the certificates (I'm on CentOS), and then reference them somehow?

Any help at all is appreciated - if you're familiar with the process, even with another library, please chip in! Thanks :)

EDIT: Fixed! For anybody else having a similar problem, the code is as follows:

soap.createClient(url, { wsdl_options: { cert: fs.readFileSync('/path/to/cert.pem'), key: fs.readFileSync('/path/to/key.key'), passphrase: 'password' } } )
Ryan Spicer
  • 501
  • 3
  • 18
  • You could post your own solution and mark it as accepted, so that your question is not left unanswered. – katronai Mar 16 '17 at 11:46

0 Answers0