Skip to main content
SOAP

Calculator Operations

RequestParseValidateMedium

Description

Call Add, Subtract, Multiply, Divide SOAP operations.

Test Scenario

const addEnvelope = `
<soap:Envelope xmlns:soap="...">
  <soap:Body>
    <Add xmlns="...">
      <a>5</a>
      <b>3</b>
    </Add>
  </soap:Body>
</soap:Envelope>`;
// Result: 8
Endpoint/api/soap

Testing Tips

  • •Same endpoint, different operations
  • •Operation name in Body element
  • •Check fault response for divide by zero
// Playwright API Testing - SOAP
import { test, expect } from '@playwright/test';
test('SOAP request', async ({ request }) => {
const soapEnvelope = `<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUsers xmlns="http://api.example.com/"/>
</soap:Body>
</soap:Envelope>`;
const response = await request.post('/api/soap', {
headers: { 'Content-Type': 'text/xml' },
data: soapEnvelope
});
expect(response.ok()).toBeTruthy();
const text = await response.text();
expect(text).toContain('soap:Envelope');
});

Challenge ID: soap-calculator

2 frameworks available

API Playground

Send requests and inspect responses

Endpoint: /api/soap

Press Enter to send