This library was created when existing libraries, like node-soap, were outdated and lacked support for promises. However, times have changed, and first-class promise support has been introduced.
Due to the advancements and lack of updates to this library, it is no longer recommended for use. For the best results, please use the *Async methods in the original library.
Convert all node-soap methods to promises. Inspired by soap-q, but it doesn't add any suffix to methods, the client has the same interface as exposed by the original soap module.
npm install soap-as-promised
const soap = require('soap-as-promised');
soap.createClient('http://example.org/wsdl')
.then((client) => client.myAwesomeSoapMethod({param: true}))
.then((result) => console.log(`The result was: ${result}`))
.catch((error) => console.error(`There was an error! ${error}`));
There are a couple of things that behave different from the original soap client:
{return: null, _rawResponse: "<SOAP RETURNED BY THE SERVICE>"}
{return: 'String response', _rawResponse: "<SOAP RETURNED BY THE SERVICE>"}
null
or {}
)