Sending SOAP Request [Node.js Code]

To make SOAP requests to the SOAP API endpoint with Node.js, use the "Content-Type: application/soap+xml" request header, which tells the server that the request body contains a SOAP envelope. The server informs the client that it has returned a SOAP envelope with a "Content-Type: application/soap+xml" response header. In this Node.js SOAP Request Example, we are sending a SOAP request to the ReqBin echo URL with a SOAP envelope in the body of the POST request. Click Send to send Node.js SOAP Request example online and see the results. The Node.js code was automatically generated for the Make SOAP Request example.
Sending SOAP Request [Node.js Code] Send
POST /xml/tempconvert.asmx HTTP/1.1
Content-Type: application/soap+xml
Content-Length: 349

<soap12:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap12="">
    <FahrenheitToCelsius xmlns="">
Updated: Viewed: 74950 times
Node.js code for Make SOAP Request example

Node.js code for Make SOAP Request Example

This Node.js code snippet was generated automatically for the Make SOAP Request example.
<< Back to the Make SOAP Request example

What is SOAP?

SOAP is an Object Access Protocol that Microsoft developed to replace older technologies such as DCOM (Distributed Component Object Model) and General CORBA (Object Request Broker Architecture). DCOM and CORBA are inferior because they rely on binary messages, while SOAP uses XML and works better over the Internet. SOAP relies exclusively on XML and, together with schemas, defines a strongly typed messaging structure. The main idea behind SOAP is that programs written in different programming languages ​​and platforms can easily exchange data.

SOAP Example
<?xml version='1.0' Encoding='UTF-8' ?>
<env:Envelope xmlns:env=""> 
  <m:reservation xmlns:m="" env:role="">
  <n:passenger xmlns:n="" env:role="">
    <n:name>John Smith</n:name>
  <p:itinerary xmlns:p="">
      <p:departing>New York</p:departing>
      <p:arriving>Los Angeles</p:arriving>

What is XML?

XML (eXtensible Markup Language) that provides structured information: data, documents, configuration, and more. XML was designed to be a language with a simple formal syntax to make it easy for both humans and programs to create and manage documents for use on the Internet. XML is called extensible because it does not capture the markup used in documents: you can generate markup according to the needs of a specific area, limited only by the rules of XML syntax.

XML Example

How to send a SOAP Request?

An example of sending a SOAP request to the SOAP API endpoint:

SOAP Request Example
POST /xml/tempconvert.asmx HTTP/1.1
Content-Type: application/soap+xml
Content-Length: 349

<?xml version="1.0" encoding="utf-8"?>      
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap12="">
    <GetUserBalance xmlns="">

SOAP response from server:

SOAP Response Example
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 413
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
    <GetUserBalanceResponse xmlns="">

See also

Generate code snippets for Node.js and other programming languages

Convert your Make SOAP Request request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the Node.js code generator.