Skip to content

CXF-8977: Add support for MTOM Serialization Policy Assertion 1.1#1685

Open
daspilker wants to merge 2 commits intoapache:mainfrom
daspilker:CXF-8977
Open

CXF-8977: Add support for MTOM Serialization Policy Assertion 1.1#1685
daspilker wants to merge 2 commits intoapache:mainfrom
daspilker:CXF-8977

Conversation

@daspilker
Copy link

@daspilker daspilker commented Feb 13, 2024

Summary

Add support for the W3C MTOM Serialization Policy Assertion 1.1 (WS-MTOMPolicy) alongside the existing 1.0 assertion (OptimizedMimeSerialization from http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization).

This allows CXF to process WSDL/policy documents that use the newer MTOM 1.1 policy namespace, which uses the {http://www.w3.org/2007/08/soap12-mtom-policy}MTOM element instead of the older {http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization}OptimizedMimeSerialization element.

Changes

  • MetadataConstants: Add MTOM11_ASSERTION_QNAME constant for the W3C MTOM 1.1 namespace
  • MTOMAssertionBuilder: Register and build assertions for both MTOM 1.0 and 1.1 QNames
  • MTOMPolicyInterceptor: Refactor to handle both assertion types via extracted assertAssertion() method
  • MTOMPolicyInterceptorProvider: Register both assertion types

Tests

  • Add testRequiredMtom11 and testOptionalMtom11 tests mirroring the existing 1.0 tests
  • Add mtom11-policy.xml and mtom11-policy-optional.xml policy files using the W3C MTOM 1.1 namespace
  • Refactor setupServer() to accept a policy resource name instead of a boolean flag

JIRA

CXF-8977

@gnodet
Copy link
Contributor

gnodet commented Mar 11, 2026

Review & Fixes

I've reviewed this PR and it looks good overall. Clean, well-structured change that correctly adds support for the MTOM Serialization Policy Assertion 1.1 namespace (http://www.w3.org/2007/08/soap12-mtom-policy / MTOM element) alongside the existing 1.0 namespace (http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization / OptimizedMimeSerialization element).

What I did

  1. Rebased onto current main — The branch was based on 4.0.4-SNAPSHOT (from 2024) and couldn't compile. Rebase was clean, no conflicts.

  2. Fixed minor code style issue — Removed an extra blank line in MetadataConstants.java between the constant declarations and the private constructor.

  3. Verified: All 133 tests in rt/ws/policy pass. Checkstyle is clean.

Review notes

The production code changes are clean and well-designed:

  • MetadataConstants — new MTOM11_ASSERTION_QNAME constant with correct W3C namespace
  • MTOMAssertionBuilder — correctly handles both QNames in KNOWN_ELEMENTS and build()
  • MTOMPolicyInterceptor — good refactoring to extract assertAssertion() as a reusable static method
  • MTOMPolicyInterceptorProvider — correctly registers both assertion types
  • Test coverage includes both required and optional variants of the MTOM 1.1 policy, mirroring the existing 1.0 tests
  • The new policy XML files correctly use the W3C MTOM 1.1 namespace

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Rebased onto current main, fixed a minor extra blank line in MetadataConstants. All tests pass, checkstyle clean. Clean and well-structured change.

@gnodet gnodet changed the title CXF-8977: add support for MTOM Serialization Policy Assertion 1.1 CXF-8977: Add support for MTOM Serialization Policy Assertion 1.1 Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants