10.5 Web Service Protocols: SOAP, REST & XML Messaging

Key Takeaways

  • SOAP is an XML-based RPC protocol, usually over HTTP POST, described by a WSDL document and often advertised by a ?wsdl query string.
  • REST uses the native HTTP methods and status codes as its interface and typically exchanges JSON, but may also exchange XML.
  • A WSDL enumerates every operation, parameter and data type a SOAP service exposes, making it a complete attack-surface map.
  • XML documents are validated against a DTD or XML Schema, and it is DTD external-entity processing that enables XXE.
  • SOAP messages carry a mandatory Envelope and Body and an optional Header used for WS-Security, which is the correct place for message-level authentication.
Last updated: September 2026

10.5 Web Service Protocols: SOAP, REST & XML Messaging

Syllabus item G4 lists HTTP, HTTPS and SOAP as the web protocols, together with all HTTP methods, response codes and security-related header fields. Item G5 covers the web mark-up languages, HTML and XML. Section 10.1 handled HTTP and its methods and codes in depth; this section covers the parts G4 and G5 add on top: SOAP web services, the REST style they are usually compared with, and the XML message model that both mark-up and SOAP depend on.

Web services are where two applications talk to each other rather than to a browser, and they are a rich attack surface precisely because they are often less scrutinised than the human-facing web UI.


1. XML: The Mark-up Model (G5)

XML (eXtensible Markup Language) is a self-describing, hierarchical text format. Unlike HTML, whose tags are fixed and describe presentation, XML tags are defined by the author and describe data.

<?xml version="1.0" encoding="UTF-8"?>
<order id="4471">
  <customer>Acme Ltd</customer>
  <items>
    <item sku="A-100" qty="3"/>
  </items>
</order>

Two validation mechanisms matter for security:

  • DTD (Document Type Definition) — the legacy grammar. Critically, a DTD can declare entities, including external entities that pull in content from a URI. This single feature is the root of XXE (XML External Entity) injection, covered in 11.4: <!ENTITY xxe SYSTEM "file:///etc/passwd"> makes a parser read a local file into the document.
  • XML Schema (XSD) — the modern, more expressive grammar. It does not have the entity mechanism and is the safer choice.

The security-relevant XML concepts are: well-formedness (correct nesting and syntax) versus validity (conformance to a DTD/XSD); namespaces (xmlns), which qualify element names; and the fact that entity expansion can be abused for denial of service (the "billion laughs" attack) as well as for file disclosure. Because so many formats are XML underneath — SOAP, SAML, SVG, DOCX/XLSX, RSS, configuration files — XML parser hardening is a cross-cutting concern.


2. SOAP Web Services (G4)

SOAP (Simple Object Access Protocol) is an XML-based protocol for calling remote operations — effectively RPC over XML, almost always transported as an HTTP POST (though SOAP is transport-independent and can run over SMTP or message queues).

A SOAP message has a fixed structure:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
     <!-- optional: WS-Security tokens, routing, transaction context -->
  </soap:Header>
  <soap:Body>
     <getBalance>
        <accountId>4471</accountId>
     </getBalance>
  </soap:Body>
</soap:Envelope>
  • Envelope — mandatory root element identifying the message as SOAP.
  • Header — optional; carries metadata, most importantly WS-Security (message-level authentication, signing and encryption of individual elements).
  • Body — mandatory; carries the actual operation call and its parameters, or a <soap:Fault> on error.

WSDL: The Attack-Surface Map

A SOAP service is described by a WSDL (Web Services Description Language) document — itself XML — that enumerates every operation the service exposes, every parameter, its data type, and the endpoint URL. WSDLs are frequently retrievable by appending a query string:

https://api.example.com/AccountService?wsdl
https://api.example.com/AccountService?WSDL

For an assessor a WSDL is a gift: it is a complete, machine-readable inventory of the service's functions. Tools like SoapUI, Burp's WSDL support, and wsdler parse it and generate template requests for every operation, so testing can proceed function by function. Even undocumented or "internal" operations appear in the WSDL, which is exactly why leaving it publicly retrievable is a finding in its own right.

SOAP-Specific Risks

  • XXE — SOAP bodies are XML, so any endpoint that parses them with external-entity processing enabled is XXE-vulnerable (11.4).
  • SOAP injection — breaking out of a parameter to inject extra XML elements, altering the logic of the call (analogous to SQL injection into a query).
  • Weak or absent WS-Security — authentication placed only at the transport layer (a single TLS session) rather than per message, or username tokens sent in cleartext within the header.
  • XML signature wrapping — moving signed elements within the document so that a signature validates while the processed content differs.
  • Verbose <soap:Fault> messages leaking stack traces and internal detail (see 11.5).

3. REST for Contrast

Most modern services are REST (REpresentational State Transfer) rather than SOAP, and the syllabus's HTTP-method and status-code knowledge (G4) maps directly onto REST.

SOAPREST
InterfaceOperations named inside the XML bodyHTTP method + URL path (GET /accounts/4471)
PayloadAlways XML (the SOAP Envelope)Usually JSON; can be XML, form data, etc.
DescriptionWSDLOpenAPI/Swagger (when published)
Verb semanticsEverything is POSTGET reads, POST creates, PUT/PATCH updates, DELETE removes
StateCan be stateful (WS-* extensions)Stateless by principle
Security metadataWS-Security in the SOAP HeaderBearer tokens / OAuth in HTTP headers

REST's reliance on HTTP verbs makes correct method handling a security matter: a DELETE reachable without authorisation, or a state-changing action wrongly exposed on GET (which enables CSRF and is cached/logged), are common findings. Section 11.4 covers API-specific flaws such as broken object-level authorisation.

Discovery of Web Services

# SOAP
GET /service?wsdl                     # retrieve the WSDL
POST /service  (Content-Type: text/xml, SOAPAction: "...")   # invoke an operation

# REST
GET /openapi.json  /swagger.json  /api-docs   # retrieve the API description
# then enumerate documented and undocumented endpoints and methods

Content discovery (section 10.3) is how undocumented service endpoints are found; the WSDL or OpenAPI document is how documented ones are mapped exhaustively.


4. Testing Web Services: The Approach

  1. Locate the service description. Try ?wsdl/?WSDL for SOAP and the common OpenAPI paths for REST; fall back to content discovery and traffic capture.
  2. Enumerate every operation/endpoint from the description, including internal-sounding ones.
  3. Test each operation's inputs for injection (SQLi, XXE, command injection, SOAP/XPath injection), because a web service parameter reaches the same back ends as a web form.
  4. Test authentication and authorisation per operation — services routinely enforce access control on the UI but not on the underlying operation, so calling the operation directly bypasses the UI's checks.
  5. Inspect error handling<soap:Fault> and REST error bodies frequently leak stack traces, framework versions and internal paths (11.5).
  6. Check the transport and message security — TLS configuration, and whether WS-Security or token validation is actually enforced.

The recurring theme is that a web service is the application without the browser in the way. Every server-side vulnerability the web UI could expose, the service can expose more directly, and often with weaker controls because developers assume only trusted systems will call it.

Test Your Knowledge

An assessor discovers a SOAP endpoint at https://api.example.com/AccountService. What is the single most valuable artefact to retrieve first, and why?

A
B
C
D
Test Your Knowledge

Which feature of XML document processing is the direct root cause of XML External Entity (XXE) injection?

A
B
C
D
Test Your Knowledge

In a SOAP message, where should message-level authentication credentials such as WS-Security tokens be carried?

A
B
C
D
Test Your Knowledge

Why does testing a web service's operations directly, rather than only through the web UI, frequently reveal authorisation flaws?

A
B
C
D