Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 36 ยท Testing and Tools

Debugging SOAP Traffic and Tools

Find out why a SOAP call fails - read the real XML with a logging proxy, use curl, SoapUI, Postman and packet tools, and diagnose the usual culprits like wrong namespaces, content types and SOAP versions.

When a SOAP call fails, the error message you see in your application is rarely the real story. A generated client may report "Unexpected element" or "Operation not found" and leave you guessing. The real story is in the XML that crossed the wire, and almost every SOAP problem becomes simple once you can see both messages with their HTTP headers.

This lesson teaches a debugging routine: capture the traffic, compare it with the contract, and check the usual suspects in order. It also tours the tools that do this for you.

The debugging routine

  1. Capture the exact request and response, headers included.
  2. Replay the request by hand (curl or a tool) to separate "my code builds a wrong message" from "the service is wrong".
  3. Compare against the WSDL: operation name, namespace, element order, types.
  4. Check the envelope basics: SOAP version, Content-Type, SOAPAction, character encoding.
  5. Read the fault carefully, including detail, not only faultstring.

Capturing traffic with a logging proxy

A logging proxy sits between client and service, copies every message to a log, and forwards it. Because it speaks plain HTTP, it works with any client: just point the client at the proxy. Tools like Fiddler, Charles, mitmproxy and the TCP/Monitor feature of SoapUI do exactly this. Here is a minimal version, with one important extra: it redacts secrets before logging, because debugging logs have a habit of leaking into tickets and chat.

Node.js A logging proxy that redacts passwords

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The log shows the redacted copy, while the client still receives the real response untouched. That separation, "copy for humans, original for the program", is the rule for every debugging tool.

Replay with curl

Once you have captured a request, save the body to a file and replay it. This eliminates your application from the problem:

Terminal
curl -sS -X POST https://example.com/service \
  -H 'Content-Type: text/xml; charset=utf-8' \
  -H 'SOAPAction: "urn:shop/GetPrice"' \
  --data @request.xml

Add -v to see request and response headers, and pipe the answer through xmllint --format - (from libxml2) to pretty-print it. For SOAP 1.2, use -H 'Content-Type: application/soap+xml; charset=utf-8; action="urn:shop/GetPrice"' and no separate header. (These commands call the network, so they are read-only here.)

The tool shelf

Tool Best for
SoapUI (open source / ReadyAPI) Loading a WSDL, generating sample requests, assertions, mock services, load tests
Postman Raw XML requests, environments, collections, scripted tests
Bruno, Insomnia, Hoppscotch Lightweight alternatives for sending raw XML
curl + xmllint Scripting and quick replays
mitmproxy, Fiddler, Charles Intercepting traffic from an application you cannot change
Wireshark / tcpdump Network-level capture when TLS is not in the way
Application logs Toolkit-level message logging (CXF LoggingFeature, WCF MessageLogging, zeep debug logging)

For HTTPS you cannot read traffic with a plain packet capture. Either use a proxy that terminates TLS with a certificate your machine trusts (only in development!), or turn on message logging inside the application.

A diagnosing helper

Most failures come from a short list of causes. This function checks a captured request for those causes and prints what it found. It is a small version of what testing tools tell you when a request is "invalid".

Node.js Checklist: why does my request fail?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The first sample trips two rules at once: the content type is wrong and the SOAPAction is missing. Real services react to these in confusing ways (a blank page, an HTML error, or a fault saying "Unsupported Media Type"), which is why a checklist saves time.

Never paste production envelopes into public tools, tickets or chat without redacting. They contain tokens, personal data and sometimes passwords in UsernameToken headers.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the first step when a SOAP call fails mysteriously?

    The raw messages usually reveal the cause immediately; everything else is guessing.
  2. 2. Which Content-Type does SOAP 1.2 use?

    SOAP 1.2 uses application/soap+xml, with the action as a parameter of the media type.
  3. 3. Why does a logging proxy redact passwords and tokens in its log but forward the real message?

    Humans and tickets see the copy; the program and the service see the original.
  4. 4. Why can't you read HTTPS SOAP traffic in a plain Wireshark capture?

    TLS hides the content. Terminate TLS at a trusted development proxy or log inside the application.

Summary

  • Capture raw requests and responses first; replay them with curl or a SOAP tool to isolate the fault.
  • Check the usual suspects: SOAP version, Content-Type, SOAPAction, namespaces, encoding, element order.
  • Logging proxies and message logging reveal what clients hide; always redact secrets.
  • SoapUI, Postman, mitmproxy, Fiddler and Wireshark cover different needs; HTTPS needs a TLS-aware approach.

Next: Contract Validation and Schema Checks