` I am testing soap client with pfx client certificate using node-soap library (https://github.com/vpulim/node-soap) with latest version 1.0.0. I am running into an error (Error creating SOAP client: AxiosError: unable to get local issuer certificate). The same pfx client cert and pwd works fine with the axios library. Please help me identify the issue here. It seems some setting is not right with wsdl_options.
I tried the following.
console.log('Test');
const soap = require("soap");
const https = require('https');
const fs = require('fs');
const url = "myWsdlUrl";
const retrieveData = {
userInput: 'Test'
};
const options = {
wsdl_options: {
method: "POST",
pfx: fs.readFileSync("./src/my-pfx-file.p12"),
passphrase: "pwd123"
}
};
console.log('Before soap.createClient');
// Create SOAP client
soap.createClient(url, options, (err:any, client:any) => {
console.log('After soap.createClient');
if (err) {
console.error('Error creating SOAP client:', err);
return;
}
const args = { getData: retrieveData };
// Call a method from the SOAP service
client.retrieveWSData(args, {}, (soapErr:any, result:any) => {
console.log('After soap.createClient');
if (soapErr) {
console.error('Error calling SOAP method:', soapErr);
return;
}
console.log('SOAP method response:', result);
});
});
-------------------------
I get the below error (occurs during soap.createClient call).
Test
Before soap.createClient
After soap.createClient
Error creating SOAP client: AxiosError: unable to get local issuer certificate
at Function.AxiosError.from (C:\\workspaces\\wrksp_nodejs_example\\soap-axios- example\\node_modules\\axios\\lib\\core\\AxiosError.js:89:14)
at RedirectableRequest.handleRequestError (C:\\softwaredistribution\\fpacdev\\workspaces\\wrksp_nodejs_example\\soap-axios- example\\node_modules\\axios\\lib\\adapters\\http.js:606:25)
at RedirectableRequest.emit (node:events:513:28)
at RedirectableRequest.emit (node:domain:489:12)
at ClientRequest.eventHandlers.\<computed\> (C:\\workspaces\\wrksp_nodejs_example\\soap-axios- example\\node_modules\\follow-redirects\\index.js:14:24)
at ClientRequest.emit (node:events:513:28)
at ClientRequest.emit (node:domain:489:12)
at TLSSocket.socketErrorListener (node:\_http_client:494:9)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:489:12) {
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',`