Skip to content

yogeshjoshi/soap-web-client

Repository files navigation

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 

About

small simple soap-web-client library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published