Skip to documentation

Guide · SOAP

Available

Mock the WSDL contract without flattening XML into JSON

DotMock discovers services and operations from WSDL, routes native SOAP 1.1 and 1.2 envelopes, and keeps action, XML, HTTP status, headers, state, and faults visible.

In this guide

  • Import WSDL and XSD sources
  • Author native success and fault envelopes
  • Match XML with XPath and shared state
  • Test, proxy, capture, and promote real SOAP traffic

Prerequisites

  • A SOAP DotMock workspace
  • A WSDL source and any required XSD dependencies
  • The workspace ID in $API_ID
On this page

Import the service contract

Create a SOAP workspace and import exactly one WSDL plus any referenced XSD documents. Compatible operation behavior survives contract updates; removed and signature-changed operations are archived for review.

bash
dotmock create api --type soap --name "Orders SOAP"
dotmock soap import --api "$API_ID" --from wsdl/
dotmock soap operations --api "$API_ID"

Route SOAP 1.1 and 1.2 natively

SOAP 1.1 uses SOAPAction plus text/xml. SOAP 1.2 carries the action parameter in application/soap+xml. DotMock also checks the endpoint path and first SOAP Body element, so clients can use the contract they already generated.

  • SOAP 1.1: SOAPAction header and 1.1 envelope namespace
  • SOAP 1.2: action content-type parameter and 1.2 envelope namespace
  • Body-element fallback when an action is omitted
  • Malformed XML returns a version-correct SOAP fault

Use XPath in ordinary conditions

Cases remain first-match-wins. XPath is a normal bounded expression function, alongside soap.action, soap.operation, soap.version, headers, query values, normalized body fields, and shared state.

javascript
xpath("//*[local-name()='amount']") == "100"
soap.action == "urn:orders/Create" && soap.version == "1.2"
!state.exists("orders", xpath("//*[local-name()='orderId']"))

Return native XML and faults

Edit the complete response envelope with XML syntax highlighting. Keep HTTP status, content type, additional headers, delay, and XML body separate. A normal conditional response can return HTTP 500 with a SOAP Fault envelope—there is no hidden failure mode.

xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <tns:GetUserResponse>
      <tns:id>{{xpath "//*[local-name()='userId']"}}</tns:id>
    </tns:GetUserResponse>
  </soap:Body>
</soap:Envelope>

Compare safe and live behavior

Safe tests execute the real XML parser, action router, XPath matcher, template engine, and state overlay without saving or proxying. Live tests persist allowed state and add a decoded capture. The result separates status, headers, envelope, SOAP metadata, and state diff.

bash
dotmock soap test --api "$API_ID" --operation Orders/OrdersPort/GetOrder --from request.xml
dotmock soap test --api "$API_ID" --operation Orders/OrdersPort/GetOrder --from request.xml --live

Proxy and promote deliberately

Configure an HTTP or HTTPS service base URL for proxy operations. Inspect complete inbound and outbound XML, then promote a useful capture only with an explicit XPath-aware condition and approval.