1.0.2 • Published 3 years ago

soap-req-json v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Soap Request To Json

Does a SOAP request and returns JSON string.

Usage

Installation

npm install soap-req-json
// or
yarn add soap-req-json

Quick Start

const srj = require('soap-req-json');

// SOAP Envelope
const envelope = `
  <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    <SOAP-ENV:Header>
        <t:Transaction :t="some-URI" SOAP-ENV:mustUnderstand="1">5</t:Transaction>
    </SOAP-ENV:Header>
  </SOAP-ENV:Envelope>`;

// URL
const url = 'https://electrocommerce.org/abc/service';

// The SOAPAction HTTP Header Field
const SOAPAction = 'https://electrocommerce.org/abc#MyMessage';

const jsonString = await srj({ envelope, url, SOAPAction })

Options

OptionTypeRequired
envelopestring SOAP Envelopetrue
urlurltrue
SOAPActionstring The SOAPAction HTTP Header Field.true
timeoutnumber Timeout request. Default 0false

Error messages

MessageDescription
INVALID_URLURL could not be parsed.
REQUEST_TIMEOUTRequest timeout.
SERVER_ERRORServer responded with error.

Dependencies

dependencies

PackageDescription
xml-jsConvert XML text to Javascript object / JSON text (and vice versa).

devDependencies

PackageDescription
@types/nodeThis package contains type definitions for Node.js
typescriptJavaScript compiler/type checker that boosts JavaScript productivity
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago