Skip to content
do- edited this page Oct 8, 2022 · 25 revisions

SOAP11 is a tool for composing SOAP 1.1 HTTP requests from plain data objects according to a given WSDL.

This is not a complete WS client as it hasn't ability to actually send messages and receive responses: those tasks are left to the satandard HTTP agent or any of its alternatives.

What SOAP11 do exactly is:

  • composing the SOAP XML text (basically serializing data objects with XMLMarshaller according to the XML Schema)
  • setting the HTTP headers, including the one named SOAPAction.
const http = require ('http')
const {SOAP11} = require ('xml-toolkit')

const soap = await SOAP11.fromFile ('their.wsdl')

const {method, headers, body} = soap.http ({RequestElementNameOfTheirs: {amount: '0.01'}})

const rq = http.request (endpointURL, {method, headers})
rq.write (body)

Static Methods

fromFile

const soap = await SOAP11.fromFile (wsdlFilePath)

This asynchronous function parses the same WSDL twice:

  • to construct the XMLSchemata instance
  • to build the object tree to look up for SOAPAction values.

Instance Methods

http

const {method, headers, body} = soap.http (requestDataObject)

The given requestDataObject is first serialized XMLSchemata.

Then, a SOAPHTTP is constructed to enclose it in a SOAP 1.1 envelope.

Additionally, the WSDL tree is scanned based on the requestDataObject's only root property name to be found as some message part element local name. If the binding contains an operation using this message, the corresponding SOAPAction is set as an HTTP header.

Finally, the {method, headers, body} object is given out.

Clone this wiki locally