SOAP
Basic SOAP Request
RequestParseValidateEasy
What you will learn
- Namespace declarations on the SOAP envelope are non-negotiable โ missing soapenv:Envelope namespace is the top bug
- Content-Type must be text/xml; charset=utf-8 for SOAP 1.1, application/soap+xml for 1.2 โ servers reject the wrong one silently
- Test SOAP Fault responses as a first-class path โ fault code + faultstring have structure, your client must parse it
Description
Send a SOAP envelope to call GetUser operation.
Test Scenario
const envelope = `
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUser xmlns="http://practice.api">
<id>1</id>
</GetUser>
</soap:Body>
</soap:Envelope>`;
const response = await request.post('/api/soap', {
headers: { 'Content-Type': 'text/xml' },
data: envelope
});Endpoint
/api/soapTesting Tips
- โขUse Content-Type: text/xml
- โขInclude SOAP envelope wrapper
- โขMatch namespace from WSDL
// Playwright API Testing - SOAPimport { 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-basic-request
2 frameworks available
API Playground
Send requests and inspect responses
Endpoint: /api/soap
Press Enter to send