Restore workaround for redundant namespace declarations on SOAP headers#172
Open
ckaaber wants to merge 2 commits into
Open
Restore workaround for redundant namespace declarations on SOAP headers#172ckaaber wants to merge 2 commits into
ckaaber wants to merge 2 commits into
Conversation
Replace setMustUnderstand() and setRole() with explicit addAttribute() calls using the envelope's namespace. Axiom's high-level setters generate redundant namespace declarations on SOAP header attributes (e.g. xmlns:mustUnderstand="..." mustUnderstand:mustUnderstand="true") which can confuse other SOAP processors when performing XML Canonicalization. This fix was originally introduced by Sander Fieten in commit ada0200 (Nov 2020) but was inadvertently lost during the project restructuring in the 6.0 development cycle when Messaging.java was copied from a version without the fix. Uses Axiom's SOAPConstants and SOAPVersion.getRoleAttributeQName() to remain SOAP-version-independent rather than hardcoding attribute names. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ders The workaround in Messaging.createElement (restored in 46b8b2c) can easily be lost during refactoring. These tests serialize the envelope and verify that mustUnderstand and role attributes do not produce redundant namespace declarations that break c14n interoperability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
holodeck-redundant-namespace-bug.md |
Author
|
I have submitted a pull request for the ws-axiom: apache/ws-axiom#771 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores the workaround originally introduced in commit ada0200 (Nov 2020) that was lost during the project
restructuring in the 6.0 development cycle (cabf0a2). Adds regression tests to prevent the fix from being lost
again.
Problem
Axiom's setMustUnderstand(true) and setRole() methods generate redundant namespace declarations on SOAP header
attributes, producing output like:
xmlns:mustUnderstand="http://www.w3.org/2003/06/soap-envelope"
mustUnderstand:mustUnderstand="true"
While technically valid XML, this confuses SOAP processors performing XML Canonicalization (c14n), causing
interoperability failures with other AS4 implementations.
Fix
Replace setMustUnderstand(true) and setRole() with explicit addAttribute() calls using the envelope's namespace.
This produces clean SOAP attributes without redundant namespace prefixes, while preserving identical SOAP
semantics.
History
This exact fix was implemented by @sffieten in ada0200 with the message:
"Work around to remove redundant namespace declarations on SOAP headers — Resolves issue with c14n by some other
MSH"
The fix was inadvertently lost when Messaging.java was moved during the project restructuring (cabf0a2).
Test plan