Skip to content


SOAP utility exposes web services framework for manipulating SOAP messages, making calls to external end-points and creating simple web services

Basic Usage

import { soap } from "sdk/net";
import { response } from "sdk/http";

response.setContentType("text/plain; charset=UTF-8");

let requestMessage = soap.createMessage();
let part = requestMessage.getPart();
let envelope = part.getEnvelope();
envelope.addNamespaceDeclaration("ws", "");
let body = envelope.getBody();
let resolveIPElement = body.addChildElement("ResolveIP", "ws");
let ipAddressElement = resolveIPElement.addChildElement("ipAddress", "ws");
let licenseKeyElement = resolveIPElement.addChildElement("licenseKey", "ws");

let mimeHeaders = requestMessage.getMimeHeaders();
mimeHeaders.addHeader("SOAPAction", "");;
response.println("Request: " + requestMessage.getText());

let responseMessage =, "");

response.println("Response: " + responseMessage.getText());



Function Description Returns
createMessage() Creates an empty SOAP Message Message
parseMessage(mimeHeaders, inputStream) Creates a message by a given MIME Headers and by parsing of the provided input stream Message
parseRequest() Creates a message by parsing the standard Request input and empty headers Message
createMimeHeaders() Creates an empty MimeHeaders MimeHeaders
call(request, url) Calls an end-point of a SOAP Web Service with a request Message and returns the response Message Message



Function Description Returns
getMimeHeaders() Returns the MimeHeaders object of this Message MimeHeaders
getPart() Returns the Part object of this Message Part
save() Save the changes made on the Message and its components -
getText() Returns a text representation of the Message string


Function Description Returns
addHeader(name, value) Creates and add a new MIME header -


Function Description Returns
getEnvelope() Returns the Envelope object of this Part Envelope


Function Description Returns
getBody() Returns the Body object of this Envelope Body
getHeader() Returns the Header object of this Envelope Header
addNamespaceDeclaration(prefix, uri) Creates and add a namespace attribute -
createName(localName, prefix, uri) Creates a Name object to be used further Name


Function Description Returns
getChildElements() Returns an array of the child Elements [Element]
addChildElement(localName, prefix) Creates and add a child Element Element
Function Description Returns
addHeaderElement(name) Creates and add a Header Element with a Name Element


Function Description Returns
getLocalName() Returns the Local Name of the Name object string
getPrefix() Returns the Prefix of the Name object string
getQualifiedName() Returns the Qualified Name of the Name object string
getURI() Returns the URI of the Name object string


Function Description Returns
getChildElements() Returns an array of the child Elements [Element]
getElementName() Returns the name of the Element Name
getValue() Returns the value of the Element if any string
addChildElement(localName, prefix) Creates and add a child Element Element
addTextNode(text) Creates and add a text node Element
addAttribute(name, value) Creates and add an attribute Element
isSOAPElement() Returns true if the Element is SOAP Element and false otherwise (e.g. CDATA, PDATA, etc.) string