DevTools Logo

SOAP Formatter

SOAP Formatter

Beautify SOAP XML request and response envelopes

Input

2 spaces

About

Beautify a SOAP XML request or response envelope. Parses the document, indents it, and re-emits clean XML. Handles namespaces and the SOAP Envelope/Header/Body structure. Runs in your browser; nothing is uploaded.

    Examples

    Beautify a SOAP 1.2 envelope

    Input
    <?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><m:GetStock xmlns:m="http://example.com/stock"><m:Symbol>IBM</m:Symbol></m:GetStock></soap:Body></soap:Envelope>
    Output
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
      <soap:Body>
        <m:GetStock xmlns:m="http://example.com/stock">
          <m:Symbol>IBM</m:Symbol>
        </m:GetStock>
      </soap:Body>
    </soap:Envelope>

    The compact one-line envelope is re-indented so the envelope, body, and the user's operation are immediately readable.

    Format a SOAP Fault

    Input
    <?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text>Server error</soap:Text></soap:Reason></soap:Fault></soap:Body></soap:Envelope>
    Output
    ...
    <soap:Body>
      <soap:Fault>
        <soap:Code>
          <soap:Value>soap:Receiver</soap:Value>
        </soap:Code>
        <soap:Reason>
          <soap:Text>Server error</soap:Text>
        </soap:Reason>
      </soap:Fault>
    </soap:Body>
    ...

    Fault sub-elements (Code, Reason, and optional Detail) are indented at the right level so the failure mode is obvious at a glance.

    About this tool

    The SOAP Formatter beautifies SOAP 1.1 and 1.2 request and response envelopes with configurable indentation. It parses the envelope, the optional header, the body, and any SOAP Fault sub-elements, then re-emits them as readable, properly-namespaced XML.

    Namespace prefixes (soap:, xsi:, m:, and your service-specific ones) are preserved verbatim, so the formatted output round-trips through any SOAP client without changes. Formatting runs entirely in your browser; the message is never transmitted or stored.

    How to use this tool

    1. Paste a SOAP message

      Drop a SOAP envelope into the editor, or load a sample 1.1 or 1.2 message to see the indentation immediately.

    2. Choose an indent

      Set the indent width (2 or 4 spaces is most common) to match your team's style.

    3. Copy the formatted XML

      Click Copy to copy the beautified envelope, or download it for use in documentation or test fixtures.

    Use cases

    Reading a SOAP response from a logs file

    Pretty-print a compact SOAP response captured by a proxy or logger so the envelope, body, and any fault are easy to scan.

    Preparing SOAP examples for documentation

    Format a request or response to put in a developer guide without making readers scroll through a maze of brackets.

    Checking XML well-formedness

    Use the formatter as a quick XML linter — unbalanced tags or missing namespace declarations show up as parse errors.

    Common mistakes

    Mistake:Confusing SOAP 1.1 and SOAP 1.2 namespaces.

    Fix:They use different namespaces (http://schemas.xmlsoap.org/soap/envelope/ vs http://www.w3.org/2003/05/soap-envelope). A 1.1 envelope is not valid as a 1.2 envelope, and vice versa.

    Mistake:Reformatting a SOAP message that contains a digital signature.

    Fix:Whitespace inside a signed element is part of the signed data. After canonicalizing and signing, don't reformat the document — keep the canonical form for verification.

    Mistake:Stripping xmlns prefixes from the output.

    Fix:Removing a namespace prefix breaks the envelope — the consumer expects SOAP-ENV, xsi, or your operation namespace to be available. The formatter preserves all prefixes.

    Frequently asked questions

    What does the formatter do?

    It parses a SOAP envelope (the SOAP 1.1 or 1.2 XML document with Envelope, Header and Body elements), reports whether it is well-formed, and re-indents it with configurable spacing so the structure — envelope, optional header, body, and any nested fault — becomes immediately readable.

    Does it preserve namespace prefixes?

    Yes. Namespace declarations on the Envelope are kept, and prefixes like soap:, xmlns:, and your service-specific prefixes are preserved verbatim so the formatted output round-trips through any SOAP client.

    What about the SOAP Fault element?

    The Fault element (under the Body) is parsed and indented like any other child, so error messages with faultcode, faultstring and detail sub-elements are clear at a glance.

    Is my SOAP message uploaded?

    No. Parsing and reformatting happen entirely in your browser; the message is never transmitted.

    References & standards