CXF-8977: Add support for MTOM Serialization Policy Assertion 1.1
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: AddMTOM11_ASSERTION_QNAMEconstant for the W3C MTOM 1.1 namespaceMTOMAssertionBuilder: Register and build assertions for both MTOM 1.0 and 1.1 QNamesMTOMPolicyInterceptor: Refactor to handle both assertion types via extractedassertAssertion()methodMTOMPolicyInterceptorProvider: Register both assertion types
Tests
- Add
testRequiredMtom11andtestOptionalMtom11tests mirroring the existing 1.0 tests - Add
mtom11-policy.xmlandmtom11-policy-optional.xmlpolicy files using the W3C MTOM 1.1 namespace - Refactor
setupServer()to accept a policy resource name instead of a boolean flag
JIRA
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
-
Rebased onto current
main— The branch was based on4.0.4-SNAPSHOT(from 2024) and couldn't compile. Rebase was clean, no conflicts. -
Fixed minor code style issue — Removed an extra blank line in
MetadataConstants.javabetween the constant declarations and the private constructor. -
Verified: All 133 tests in
rt/ws/policypass. Checkstyle is clean.
Review notes
The production code changes are clean and well-designed:
MetadataConstants— newMTOM11_ASSERTION_QNAMEconstant with correct W3C namespaceMTOMAssertionBuilder— correctly handles both QNames inKNOWN_ELEMENTSandbuild()MTOMPolicyInterceptor— good refactoring to extractassertAssertion()as a reusable static methodMTOMPolicyInterceptorProvider— 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