cxf icon indicating copy to clipboard operation
cxf copied to clipboard

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

Open daspilker opened this issue 2 years ago • 1 comments

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

daspilker avatar Feb 13 '24 12:02 daspilker

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

gnodet avatar Mar 11 '26 07:03 gnodet