All Posts
SOAPWSDLMock APIs

Mock a SOAP API from a WSDL File in 60 Seconds — No Java Required

Kiran MayeeMarch 28, 20267 min read

SOAP is still alive in finance, telecom, healthcare, logistics, and internal enterprise systems. The challenge is not understanding SOAP itself. The challenge is testing and mocking SOAP quickly without standing up a Java stack, old plugins, and brittle local tooling.

If you have ever spent hours configuring Axis2, CXF, or legacy containers just to return one XML response, this guide is for you. You can mock a SOAP API from WSDL in about a minute using a schema-first flow.

Why SOAP Mocking Feels Hard

Most teams inherit SOAP integrations rather than design them. That means unfamiliar namespaces, complex XSD types, and operation contracts that are hard to reproduce manually.

  • WSDL contains multiple bindings and schemas.
  • Enterprise payloads include nested complex types.
  • Manual XML crafting is error-prone and slow.
  • Traditional tools assume Java-heavy setup paths.

What You Need

  1. A WSDL file or WSDL URL.
  2. A target operation you want to test.
  3. A mock endpoint host where frontend or integration tests can call.

60-Second Workflow in moqapi.dev

  1. Open moqapi.dev/dashboard and create a project.
  2. Choose SOAP import and upload your WSDL file.
  3. Review parsed services and operations (for example GetCustomer, CreateOrder).
  4. Generate mock responses from the imported schema.
  5. Copy generated SOAP endpoint URL and call it from your client or test suite.

Example SOAP Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://example.com/customer">
  <soapenv:Header/>
  <soapenv:Body>
    <cus:GetCustomerRequest>
      <cus:customerId>C-1001</cus:customerId>
    </cus:GetCustomerRequest>
  </soapenv:Body>
</soapenv:Envelope>

Example SOAP Response

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://example.com/customer">
  <soap:Body>
    <cus:GetCustomerResponse>
      <cus:customerId>C-1001</cus:customerId>
      <cus:name>Alicia Gomez</cus:name>
      <cus:status>ACTIVE</cus:status>
      <cus:tier>GOLD</cus:tier>
    </cus:GetCustomerResponse>
  </soap:Body>
</soap:Envelope>

This is enough to unblock frontend teams, integration tests, and partner simulations without waiting on downstream environments.

How It Compares to SoapUI

SoapUI remains useful for request exploration and manual testing. But if your goal is hosted mock endpoints for team workflows and CI, pure desktop tools are often not enough.

  • SoapUI strength: deep request crafting and exploratory testing.
  • SoapUI limit: collaboration and stable hosted endpoint sharing can be awkward.
  • moqapi.dev strength: team-accessible endpoints, generated data, and repeatable automation-friendly mocks.

Practical Testing Scenarios

  • Frontend team verifies XML parsing and error rendering.
  • Backend team runs contract tests before connecting to vendor sandbox.
  • QA validates retries, timeout handling, and malformed SOAP faults.
  • CI executes nightly integration checks against deterministic responses.

Mocking SOAP Faults for Realism

Do not test only successful responses. Include invalid account IDs, authorization failures, and service unavailability. You can define fault variants so clients learn to handle production behavior, not just demos.

<soap:Fault>
  <faultcode>soap:Client</faultcode>
  <faultstring>Customer not found</faultstring>
</soap:Fault>

Common Mistakes and Fixes

  • Namespace mismatch: ensure request namespaces match operation definition exactly.
  • Wrong SOAP action: verify headers and binding operation action URI.
  • XSD validation failures: confirm required elements are present in correct order.
  • Character encoding issues: standardize UTF-8 across request builders and test runners.

Migration Strategy for Legacy SOAP Integrations

Even if you plan to move to REST or GraphQL later, SOAP mocks give immediate delivery value now. You can shield client development from legacy system delays, then migrate endpoints incrementally with contract-aware tests.

Enterprise SOAP Security and Compliance Checklist

Legacy SOAP systems often operate in regulated environments, so test setup must include security behavior, not only payload shape. Validate WS-Security headers where applicable, enforce strict XML parsing, and sanitize logs to avoid leaking account identifiers.

  • Validate auth header requirements and failure responses.
  • Test malformed XML handling without parser crashes.
  • Confirm PII masking in request/response logs.
  • Include TLS and certificate assumptions in test docs.

CI Pattern for SOAP Reliability

Add two checks in CI: one for happy path response conformance and one for fault-handling behavior. This ensures clients continue to parse successful responses and degrade gracefully on failures.

SOAP CI gates:
  - contract parse check: pass/fail
  - required element presence check
  - fault response handling check
  - namespace consistency check

SOAP Troubleshooting Playbook

When SOAP tests fail, debug in this order: validate endpoint URL and SOAP action, inspect namespace declarations, verify required element ordering, then inspect auth headers. This sequence resolves most failures quickly because it checks protocol-level assumptions before payload-level logic.

  • Capture raw request and raw response, not prettified versions.
  • Compare failing payload against WSDL-generated sample.
  • Check whether optional elements are incorrectly omitted.

Final Takeaway

Mocking SOAP no longer needs heavy local infrastructure. Import WSDL, generate realistic XML responses, and share a working endpoint with your whole team in minutes. If your enterprise stack still depends on SOAP, this is one of the fastest ways to reduce integration friction.

Create your first WSDL-based mock at moqapi.dev/signup.

Share this article:

About the Author

Kiran Mayee

Founder and sole developer of moqapi.dev. Full-stack engineer with deep experience in API platforms, serverless runtimes, and developer tooling. Built moqapi to solve the mock data and deployment friction she experienced firsthand building production APIs.

Ready to build?

Start deploying serverless functions in under a minute.

Get Started Free