| Previous | Next |
| MQ_ERROR_Q_ADS_PROPERTY_NOT_SUPPORTED | MQ_ERROR_UNSUPPORTED_CLASS |
MQ_ERROR_BAD_XML_FORMAT
What this result actually narrows down
The important part of MQ_ERROR_BAD_XML_FORMAT is not only whether the call failed, but which MSMQ subsystem had enough information to return this specific result. Its diagnostic boundary is application-supplied SRMP XML is not well formed. Validate the fragment as XML with namespaces and encoding before assigning the SOAP header property.
For MQ_ERROR_BAD_XML_FORMAT, capture the parser line/column and a redacted hash of the original Unicode text. When diagnosing MQ_ERROR_BAD_XML_FORMAT, logging only the post-escaped transport representation can hide the defect introduced before MSMQ received it.
When diagnosing MQ_ERROR_BAD_XML_FORMAT, SRMP carries message metadata in SOAP/XML form. In the MQ_ERROR_BAD_XML_FORMAT path, application-generated SOAP header content must be well-formed XML before MSMQ can merge or serialize it into an envelope.
MSMQ objects involved
| Subsystem | SRMP message construction and the XML/SOAP envelope properties |
|---|---|
| Decisive boundary | well-formed XML is required before MSMQ can incorporate application-supplied header material into an SRMP message |
| Code-specific focus | application-supplied SRMP XML is not well formed |
| Primary recovery rule | Do not escape the entire document twice; correct the exact parser error. |
When diagnosing MQ_ERROR_BAD_XML_FORMAT, the failure occurs before XML can be used as valid SRMP metadata. In the MQ_ERROR_BAD_XML_FORMAT path, network tracing or queue recreation cannot make malformed markup well formed. For MQ_ERROR_BAD_XML_FORMAT, the code-specific boundary is application-supplied SRMP XML is not well formed.
Triage data
- The exact unicode xml supplied before serialization; associate it explicitly with
MQ_ERROR_BAD_XML_FORMAT. - When diagnosing
MQ_ERROR_BAD_XML_FORMAT, encoding declaration, namespaces, element nesting, and prohibited characters; capture the value before cleanup or retry changes it. - In the
MQ_ERROR_BAD_XML_FORMATpath, whether the content was placed in the soap header, body, or complete envelope property; compare it with a known-good call using the same account and queue type. - For this
MQ_ERROR_BAD_XML_FORMATresult, record the queue path or format name, local/remote placement, transactional flag, caller SID, process build, and UTC correlation ID when they apply.
For MQ_ERROR_BAD_XML_FORMAT, log certificate thumbprints, provider names, SIDs, GUIDs, lengths, and hashes where useful, but do not log private keys, symmetric keys, credentials, or confidential message bodies.
A safe investigation order
- Record the unsigned HRESULT,
MQ_ERROR_BAD_XML_FORMAT, and the native API or COM method before a framework replaces it with a generic exception. - When diagnosing
MQ_ERROR_BAD_XML_FORMAT, capture encoding declaration, namespaces, element nesting, and prohibited characters. - In the
MQ_ERROR_BAD_XML_FORMATpath, capture whether the content was placed in the SOAP header, body, or complete envelope property. - Reproduce with the smallest queue/message/property set that still returns
MQ_ERROR_BAD_XML_FORMAT; change one precondition at a time. - For
MQ_ERROR_BAD_XML_FORMAT, verify the postcondition after the failed call: queue existence, message presence, directory object state, transaction outcome, or generated output may differ by result. - When diagnosing
MQ_ERROR_BAD_XML_FORMAT, apply the code-specific recovery rule: Do not escape the entire document twice; correct the exact parser error.
Correct response
Do not escape the entire document twice; correct the exact parser error.
When diagnosing MQ_ERROR_BAD_XML_FORMAT, retry only after a measurable state change: corrected property data, resized storage, restored service/directory reachability, recreated handle, completed transaction recovery, or repaired certificate access. In the MQ_ERROR_BAD_XML_FORMAT path, bound attempts and keep an idempotency key for sends or directory mutations.
What this code is not
In the MQ_ERROR_BAD_XML_FORMAT path, queue recreation, permission changes, and network retries cannot correct malformed XML supplied before SRMP serialization. The specific focus for MQ_ERROR_BAD_XML_FORMAT remains application-supplied SRMP XML is not well formed.
- In the
MQ_ERROR_BAD_XML_FORMATpath, granting broad queue or certificate permissions may mask the symptom while creating a security defect. For thisMQ_ERROR_BAD_XML_FORMATresult, test the exact identity and access needed by the operation. - For this
MQ_ERROR_BAD_XML_FORMATresult, changing queue names, deleting directory objects, or recreating certificates without reconciliation can create a second object while callers still reference the first.
Example failure path
An http transport integration encounters MQ_ERROR_BAD_XML_FORMAT. For MQ_ERROR_BAD_XML_FORMAT, it validates the original Unicode XML and fixes the first parser error before assigning the MSMQ property again. When diagnosing MQ_ERROR_BAD_XML_FORMAT, the acceptance test then changes only the decisive precondition and confirms both the HRESULT and the actual queue/message state.
Automated coverage should preserve the original arrays/identities, confirm that cleanup is safe after MQ_ERROR_BAD_XML_FORMAT, and test that a retry does not duplicate messages or directory objects.
Technical references
- Microsoft: PROPID_M_SOAP_ENVELOPE — source used for the
MQ_ERROR_BAD_XML_FORMATanalysis. - W3C: XML 1.0 — source used for the
MQ_ERROR_BAD_XML_FORMATanalysis. - W3C: SOAP 1.2 messaging framework — source used for the
MQ_ERROR_BAD_XML_FORMATanalysis. - Microsoft: Message Queuing error and information codes — source used for the
MQ_ERROR_BAD_XML_FORMATanalysis.
Looking for a different code? Search another status or error code.