small simple soap-web-client library to make SOAP Client written in Typescript
yarn add soap-web-clientor
npm install soap-web-client
node.js >= 7.6.0
const fs = require('fs');
const soaprequest = require('soap-web-client');
const url = 'http://www.dneonline.com/calculator.asmx';
const sampleHeaders = {
'Content-Type': `text/xml; charset=utf-8`,
'Content-Length': Infinity,
'SOAPAction': "http://tempuri.org/Add"
};
const data = fs.readFileSync('request.xml', 'utf-8');
//Use With Async Await
(async () => {
const { response } = await soaptestrequest({ url, data, headers : sampleHeaders});
const {headers, body, status, message} = response;
})();
##Output Format
Promise Success Output -
{
response :
{
"headers" : "",
"body" : "",
"status" : 200,
"message" : "SOAP_WEB_CLIENT_REQUEST_SUCCESS"
}
}
Promise Failure -
{
response : {
"message" : "SOAP_WEB_CLIENT_REQUEST_FAILURE",
"data" : "error response"
}
}
* Test has been covered in Jest Using Axios-Mock-Adapter* To run the test case for repository -
yarn testor
npm run test
* To see the code coverage for repository -
yarn coverageor
npm run coverage