SOAP & WSDL Mocking — Enterprise API Testing Made Simple
Import a WSDL definition and moqapi will parse all operations, generate realistic XML mock responses, and serve them over a standard SOAP endpoint. Perfect for testing SOAP integrations without a live service.
01 — How It Works
- Create a Mock API — Select "SOAP / WSDL" as the type.
- Import WSDL — Paste your WSDL XML or provide a URL. moqapi validates and stores it in R2.
- Automatic Operations — Every WSDL operation gets a mock handler that returns properly-structured SOAP envelopes.
- Test with Any SOAP Client — Use SoapUI, Postman, or cURL to call your mock endpoint.
02 — Calling a SOAP Endpoint
Your mock SOAP endpoint is available at https://moqapi.dev/api/invoke/{projectId}/{base-path}. You can find the exact URL in your project's Mock API editor.
curl -X POST https://moqapi.dev/api/invoke/{projectId}/my-soap-api \
-H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction: GetUser" \
-d '<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserRequest>
<UserId>123</UserId>
</GetUserRequest>
</soap:Body>
</soap:Envelope>'import requests
ENDPOINT = "https://moqapi.dev/api/invoke/{projectId}/my-soap-api"
soap_body = """<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserRequest>
<UserId>123</UserId>
</GetUserRequest>
</soap:Body>
</soap:Envelope>"""
res = requests.post(
ENDPOINT,
data=soap_body,
headers={
"Content-Type": "text/xml; charset=utf-8",
"SOAPAction": "GetUser",
},
)
print(res.text)from zeep import Client
from zeep.transports import Transport
import requests
# Point zeep at your mock WSDL
WSDL_URL = "https://moqapi.dev/api/invoke/{projectId}/my-soap-api?wsdl"
session = requests.Session()
transport = Transport(session=session)
client = Client(WSDL_URL, transport=transport)
# Call any operation defined in the WSDL
result = client.service.GetUser(UserId=123)
print(result)import soap from 'soap';
const WSDL_URL = 'https://moqapi.dev/api/invoke/{projectId}/my-soap-api?wsdl';
const client = await soap.createClientAsync(WSDL_URL);
// Call an operation
const [result] = await client.GetUserAsync({ UserId: 123 });
console.log(result);<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetUserResponse>
<UserId>a1b2c3d4-e5f6-7890</UserId>
<Name>Jane Cooper</Name>
<Email>jane.cooper@example.com</Email>
<Phone>+1-555-0123</Phone>
<Status>Active</Status>
</GetUserResponse>
</soap:Body>
</soap:Envelope>03 — WSDL Discovery
Append ?wsdl to your endpoint URL to retrieve the original WSDL definition. SOAP clients can use this for automatic service discovery.
curl https://moqapi.dev/api/invoke/{projectId}/my-soap-api?wsdl04 — Operation Detection
moqapi detects the target operation using two methods:
SOAPAction Header
The standard way. Set the SOAPAction HTTP header to the operation name.
Body Inspection
If no SOAPAction header is present, moqapi inspects the SOAP body to match element names against known operations.
05 — Smart XSD Data Generation
Just like GraphQL mocking, SOAP responses use smart heuristics:
xsd:stringwith name containing "email" → realistic emailxsd:stringwith name containing "name" → person namexsd:integer / xsd:int→ random integersxsd:decimal / xsd:double→ decimal numbersxsd:boolean→ true/falsexsd:date→ ISO date stringsxsd:dateTime→ ISO datetime strings
// SOAP Fault Handling
If an unknown operation is called, moqapi returns a standard SOAP Fault envelope with a Client fault code and descriptive message. This matches real SOAP service behavior.
// How Mock Data Works
Unlike REST resource mock APIs, SOAP mock APIs generate XML responses automatically at request time. moqapi reads your WSDL's XSD types and uses field-name heuristics and Faker.js to produce realistic XML element values. Simply import your WSDL, click any operation in the request builder, and send. Each request produces fresh mock data matching your schema types.