Route Behavior

SOAP & XML

Plenty of systems you have to integrate with still speak SOAP, and the awkward part of mocking one isn't the XML — it's that every operation shares the same URL and method, exactly like GraphQL. MockBase handles both halves: a match source that reads values out of the request envelope, and a raw XML response body.

Matching on the request envelope

Add a match condition with source soap_body. The key is a dot-separated path of element names:

source: soap_body
key: GetUser.userId
operator: equals
value: 42

Namespace prefixes are ignored, so you write the plain element names and it matches whatever prefixes the calling client happens to use — <ns1:userId>, <u:userId> and <userId> all resolve the same way. That matters because those prefixes vary between clients for the exact same operation.

The path can start at the document root or at any element inside it, so both of these find the same value:

The short form is what makes matching on a single parameter practical, rather than restating the envelope every time.

Routing by operation

SOAP's equivalent of a GraphQL operation name is the element directly inside <Body>. Match on it with exists:

source: soap_body
key: GetUser
operator: exists

If the client sends a SOAPAction header instead, there's nothing SOAP-specific to configure — that's an ordinary header, so use the header source with key SOAPAction. See Conditional Matching for the full operator list.

A body that isn't valid XML simply doesn't match, the same way a non-JSON body doesn't match a body condition — it never produces an error.

Returning XML

Click Use XML above the response body editor. The editor switches from JSON to a syntax-highlighted XML editor, pre-filled with a SOAP envelope, and the Content-Type becomes text/xml; charset=utf-8 — editable, so the same mode works for any other text payload (CSV, HTML, plain text). Back to JSON returns to the JSON editor with whatever JSON you had before still intact.

Unlike a binary response, an XML body still runs through dynamic templates when templating is on. That's what lets a mocked SOAP response echo a value back out of the request it was matched on:

xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetUserResponse>
      <userId>{{ request.query.id }}</userId>
    </GetUserResponse>
  </soap:Body>
</soap:Envelope>

Everything else about the route is unchanged: status code, delay, priority, chaos injection, and version history all behave exactly as they do on a JSON route.

What isn't supported

There's no WSDL support — MockBase doesn't parse a WSDL document or generate routes from one, so operations are configured by hand. There's also no gRPC: that needs end-to-end HTTP/2 with trailers, which is a different transport from the HTTP/1.1 endpoint every mock is served over.

Safety

Request envelopes are parsed with a hardened XML parser that refuses entity-expansion attacks (the "billion laughs" class of denial-of-service payload) and never resolves external entities, so a hostile body sent to your mock can't turn into a resource exhaustion problem.