Home/SOAP Track/SOAP Fault Handling & Logging

SOAP Fault Handling & Logging

Parse SOAP faults correctly, extract actionable detail, and log what matters for production debugging.

SOAP Fault Structure

A SOAP Fault has: faultcode (category), faultstring (human message), faultactor (who caused it), and detail (structured error data). The detail element is carrier-specific and contains the actually useful information — error codes, field names, and resolution hints.

Parsing Faults

Don't just log the faultstring. Parse the detail element to extract carrier-specific error codes and affected fields. Map these to your internal error model. Many carrier faults contain nested error arrays — iterate them all.
Carrier Reality

UPS SOAP faults contain a PrimaryErrorCode and an array of AdditionalErrorCodes. The primary code is often generic ('invalid request'). The additional codes tell you which field failed validation and why.

What to Log

Log: (1) your correlation ID, (2) the full SOAP request (scrub auth), (3) the full SOAP response, (4) parsed error codes, (5) timestamp, (6) carrier endpoint URL. In production, redact sensitive fields (tracking numbers, addresses) but keep the structure. These logs are your lifeline during incidents.

Practice Drills

Which part of a SOAP Fault contains the most actionable error information?

When logging SOAP errors, always include: your , the full (scrub auth), the full , parsed , and the carrier URL.