TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Call a calculator operation

POSThttps://api.testingapis.com/api/soap/calculatorSign in to see this endpoint's URL

Call a calculator operation: Add, Subtract, Multiply or Divide.

SOAP 1.1: send Content-Type: text/xml and SOAPAction: "http://tempuri.org/Add" (optional; if sent, it must name the operation in the body). ```

<Add xmlns="http://tempuri.org/"><intA>5</intA><intB>3</intB></Add> </soap:Body> </soap:Envelope> ` SOAP 1.2: send Content-Type: application/soap+xml with the same body, using the http://www.w3.org/2003/05/soap-envelope namespace.

The response is <AddResponse><AddResult>8</AddResult></AddResponse>, using the same SOAP version as the request. Errors come back as SOAP Faults. SOAP 1.1 faults always use 500. SOAP 1.2 uses 400 for Sender faults and 500 for Receiver faults. Divide by zero is a Server/Receiver fault. DTDs are rejected.

Parameters 1

NameTypeDescription
SOAPActionheader · stringSOAP 1.1 action, e.g. "http://tempuri.org/Add". Not used for SOAP 1.2.

Request body

Optional. text/xml, application/soap+xml. SOAP 1.1 envelope (send SOAPAction). SOAP 1.2 uses application/soap+xml.

Example body
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Add xmlns="http://tempuri.org/"><intA>5</intA><intB>3</intB></Add></soap:Body></soap:Envelope>

Responses

200
SOAP response envelope.
400
SOAP 1.2 Sender fault (bad input).
415
Content-Type is not text/xml or application/soap+xml.
500
SOAP Fault (all SOAP 1.1 faults; SOAP 1.2 Receiver faults).

Example

Request
curl -X POST "https://api.testingapis.com/api/soap/calculator" \
  -H "Content-Type: text/xml; charset=utf-8" \
  -H 'SOAPAction: "http://tempuri.org/Add"' \
  -d '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Add xmlns="http://tempuri.org/"><intA>5</intA><intB>3</intB></Add></soap:Body></soap:Envelope>' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <AddResponse xmlns="http://tempuri.org/">
      <AddResult>8</AddResult>
    </AddResponse>
  </soap:Body>
</soap:Envelope>

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.