Skip to content

Restore workaround for redundant namespace declarations on SOAP headers#172

Open
ckaaber wants to merge 2 commits into
holodeck-b2b:masterfrom
ckaaber:fix/restore-namespace-workaround
Open

Restore workaround for redundant namespace declarations on SOAP headers#172
ckaaber wants to merge 2 commits into
holodeck-b2b:masterfrom
ckaaber:fix/restore-namespace-workaround

Conversation

@ckaaber

@ckaaber ckaaber commented Feb 19, 2026

Copy link
Copy Markdown

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

  • New regression tests verify serialized envelope has no redundant namespace declarations
  • Existing MessagingTest passes (verifies mustUnderstand semantics)
  • Full holodeckb2b-ebms3as4 module test suite passes

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>
@ckaaber ckaaber marked this pull request as ready for review February 20, 2026 07:41
@ckaaber

ckaaber commented Feb 26, 2026

Copy link
Copy Markdown
Author

holodeck-redundant-namespace-bug.md
A more thorough analysis of the problem this workaround seeks to adress.

@ckaaber

ckaaber commented Feb 26, 2026

Copy link
Copy Markdown
Author

I have submitted a pull request for the ws-axiom: apache/ws-axiom#771
To hopefully fix the root cause and thus obviate the need for the work-around.
In the meantime I believe it would be wise to consider the work-around in Holodeck as that is under direct control and users of Holodeck are directly impacted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants