node.soap client gettings [Error: DEPTH_ZERO_SELF_SIGNED_CERT] error

1,070 views
Skip to first unread message

Reza Razavipour

unread,
Oct 31, 2013, 12:21:08 PM10/31/13
to nod...@googlegroups.com

I have a node app using the soap module, node-soap. I am creating a soap client using a URL. On the mentioned URL, there is a self signed certificate and it is causing a [Error: DEPTH_ZERO_SELF_SIGNED_CERT]. I am not finding much on this but is there is any setting I can tweak for this client to get around this error?

My code is the following:

var url3 = "https://172.31.19.39/MgmtServer.wsdl";

var args3 = { "user": "admin-priv", "password":"password"};
soap.createClient(url3, function(err, client) {

    if (err) {
        console.error(err);
        return;
    }

    console.log(client.describe().MgmtServer.MgmtServer.mgmtValidatePassword);
    client.MgmtServer.MgmtServer.mgmtValidatePassword(args3, function(err, result) {

        if (err) {
            console.error(err);
            return;
        }

        console.log(result);
    });
});

the output is [Error: DEPTH_ZERO_SELF_SIGNED_CERT] [Error: DEPTH_ZERO_SELF_SIGNED_CERT]

Any way to deal with this? the certificate is a valid, not expired, self signed certificate

Reza Razavipour

unread,
Oct 31, 2013, 1:03:47 PM10/31/13
to nod...@googlegroups.com
Added 

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

now I get past that error, I get the client.describe and the client call fails.

The code is 

var url3 = "https://172.31.19.39/MgmtServer.wsdl";


var args3 = { "user": "admin-priv", "password":"password"};

soap.createClient(url3, function(err, client) {


if (err) {

console.error(err);

return;

}


console.log(client.describe().MgmtServer.MgmtServer.mgmtValidatePassword);

client.MgmtServer.MgmtServer.mgmtValidatePassword(args3, function(err, result) {


if (err) {

console.error(err);

return;

}

and the output is now

{ input: { user: 'xsd:string', password: 'xsd:string' },

  output: 

   { rsp: 

      { nsName: 'complexType',

        namespace: 'ns',

        name: 'complexType',

        children: [Object],

        xmlns: 'urn:MgmtServer',

        '$name': 'MGMT-RESPONSE-S' } } }

{ [Error: connect ECONNREFUSED]

  code: 'ECONNREFUSED',

  errno: 'ECONNREFUSED',

  syscall: 'connect' }

{ [Error: connect ECONNREFUSED]

  code: 'ECONNREFUSED',

  errno: 'ECONNREFUSED',

  syscall: 'connect' }

not sure where the ECONNREFUSED is caused by.

Thoughts on this?

Reply all
Reply to author
Forward
0 new messages