wprater / easy-soap-request

Small Node.js library to make SOAP requests easier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

easy-soap-request

Travis npm version npm downloads Dependencies status Dev Dependencies status Known Vulnerabilities Coveralls Status

NPM

A small library to make SOAP requests easier

Installation

npm install easy-soap-request

Requirements

  • Node.js >=7.6.0 (async/await support)

Usage

const soapRequest = require('easy-soap-request');
const fs = require('fs');

// example data
const url = 'https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php';
const headers = {
  'user-agent': 'sampleTest',
  'Content-Type': 'text/xml;charset=UTF-8',
  'soapAction': 'https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode',
};
const xml = fs.readFileSync('test/zipCodeEnvelope.xml', 'utf-8');

// usage of module
(async () => {
  const { response } = await soapRequest(url, headers, xml, 1000); // Optional timeout parameter(milliseconds)
  const { body, statusCode } = response;
  console.log(body);
  console.log(statusCode);
})();

Tests

About

Small Node.js library to make SOAP requests easier

License:MIT License


Languages

Language:JavaScript 100.0%