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

When investigating webhook replay or ordering incidents, log the carrier ID, your internal ID, the signature-verification , the event , and the queue or worker that handled it.

A SOAP fault returns `faultstring='Validation error'` and a `detail` block that names `PackageWeight` as invalid. Which field should drive the first repair step?