SOAP (Simple Object Access Protocol) is a protocol used for exchanging structured information using XML. SOAP APIs are commonly used in enterprise systems and are tested using WSDL files and XML-based requests.
A SOAP message is an XML document consisting of an envelope, header, and body. The WSDL defines available operations, parameters, and endpoints.
<!-- Basic SOAP Envelope structure -->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<!-- Request payload goes here -->
</soapenv:Body>
</soapenv:Envelope>
<!-- SOAP request for GetUser operation -->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:usr="http://example.com/user">
<soapenv:Header/>
<soapenv:Body>
<usr:GetUser>
<usr:UserId>101</usr:UserId>
</usr:GetUser>
</soapenv:Body>
</soapenv:Envelope>
The server processes the XML request and returns a SOAP XML response containing the requested data or a fault message in case of errors.
<!-- SOAP response returned by server -->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetUserResponse>
<Name>John</Name>
<Email>john@example.com</Email>
</GetUserResponse>
</soapenv:Body>
</soapenv:Envelope>
You can visualize SOAP communication as a strict XML contract where both client and server must strictly follow the WSDL definition.
Type a User ID to see how the XML payload is constructed dynamically.
Generated Request Payload: