• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Small Node.js library to make SOAP requests easier

easy-soap-request

Build Status npm version npm downloads Buy Me A Coffee NPM

A small library to make SOAP requests easier via Node.js, Deno, and your browser

Installation

npm install easy-soap-request

Usage

Node.js

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

// example data
const url = 'https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php';
const sampleHeaders = {
  '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/zip-code-envelope.xml', 'utf-8');

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

Deno

import soapRequest from 'https://deno.land/x/easy_soap_request/index.d.js';

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

// usage of module
(async () => {
  const xml = await Deno.readFile('test/zip-code-envelope.xml');
  const { response } = await soapRequest({ url: url, headers: sampleHeaders, xml: xml });
  const { headers, body, statusCode } = response;
  console.log(headers);
  console.log(body);
  console.log(statusCode);
})();

Browser

Note: CORS policies apply

<html>
<script src="https://cdn.jsdelivr.net/npm/easy-soap-request/dist/easy-soap-request.js"></script>
<script>
    const url = 'https://my-soap-server';
    const sampleHeaders = {
        'Content-Type': 'text/xml;charset=UTF-8',
        SOAPAction: 'https://my-soap-action/something',
    };
    const xml = `<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                 <soapenv:Header/>
                 <soapenv:Body>Some Data</soapenv:Body>
                 </soapenv:Envelope>`;
    async function makeRequest() {
        const { response } = await soapRequest({ url: url, headers: sampleHeaders, xml: xml, timeout: 1000 });
        const { headers, body, statusCode } = response;
        console.log(headers);
        console.log(body);
        console.log(statusCode);
        document.body.innerHTML = body;
    };
    makeRequest();
</script>
<body></body>
</html>

Changelog

Changelog.md

Tests

More Repositories

1

device-monitor-dashboard

Python script to generate html report of device online/offline status
Python
111
star
2

express-jwt

An example API for creating/verifying json web tokens
JavaScript
106
star
3

blockerized-dockchain

Because all problems are solvable with containers and blockchains
Python
86
star
4

k8s-label-rules-webhook

A validating admission webhook to ensure compliant labels in your k8s cluster
Go
53
star
5

terraform-provider-mcbroken

Base the count of your infrastucture resources on the current number of broken mcdonald's ice cream machines nationally or by a city of your choosing. Powered by https://mcbroken.com/
Go
30
star
6

go-geofence

A small library to detect if an IP address is close to yours or another of your choosing using https://ipbase.com
Go
18
star
7

pumpkin-pi

Raspberry pi project that controls jack-o-lantern via servo motor and PIR motion sensors
Go
18
star
8

go-aws-news

Go app + library to fetch what's new from AWS
Go
17
star
9

caddy-geofence

A caddy module for IP geofencing your caddy web server using ipbase.com
Go
15
star
10

terraform-provider-mailform

A terraform provider to send physical mail via https://mailform.io
Go
14
star
11

web-link-tester

Flask App to scrape hrefs from websites and validate links
HTML
12
star
12

cv-notifier

Easily detect objects using computer vision and call configurable webhooks
Python
10
star
13

vault-plugin-secrets-jenkins

A plugin for Hashicorp Vault to create ephemeral users and API tokens for Jenkins CI
Go
8
star
14

local-puppet-dev

Docker setup for testing puppet manifests
Puppet
8
star
15

ava

A discord implementation of the famous ava bot
JavaScript
6
star
16

react-foaas-card

The most offensive of react components
JavaScript
6
star
17

go-mailform

A small library to send physical mail from your Go applications using https://mailform.io
Go
5
star
18

filter-object-array

Small Node.js library to filter an array of objects with an object
JavaScript
4
star
19

mcbroken-dashboard

Entry for digitalocean app platform hackathon
Go
4
star
20

google-home-aws-news

A webhook for google assistance integrations to provide the latest AWS news
Go
4
star
21

terraform-local-minio

Automatically install and create local buckets with public policies for testing
HCL
4
star
22

github-pr-exporter

A prometheus exporter for monitoring pull requests for specified users in the last X number of days.
Go
3
star
23

packer-aws-tomcat-template

A packer template to build AMI's with apache tomcat installed and systemd enabled. Based on Amazon linux.
HCL
3
star
24

witchonstephendrive.com

A home automation project to control my Halloween decorations
Go
2
star
25

href-scraper

ruby CLI to scrape hrefs from single webpages
Ruby
1
star
26

prometheus

Deployment of my personal prometheus instance
HCL
1
star
27

circa10a.github.io

Hosting of Portfolio
JavaScript
1
star
28

circa10a

My profile readme
1
star
29

l33tcrypto

Cryptography for the most l33t haxx0rs
Java
1
star