Skip to content

Latest commit

 

History

History
66 lines (53 loc) · 1.68 KB

README.md

File metadata and controls

66 lines (53 loc) · 1.68 KB

soap-web-client

small simple soap-web-client library to make SOAP Client written in Typescript

build Coverage License

Install

yarn add soap-web-client
or
npm install soap-web-client

Requirements

node.js >= 7.6.0

How to use ?

Node.js

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 and Code Coverage

* Test has been covered in Jest Using Axios-Mock-Adapter
* To run the test case for repository -
 yarn test 
or
 npm run test 

* To see the code coverage for repository -
 yarn coverage 
or
 npm run coverage