JAXB SOAP Client and Mock Endpoint: Default Namespace Inheritance Across Metro and MOXy
0 reputation · 08 Jun 2023, 21:33 UTC
When a JAXB-mapped SOAP client is pointed at a mock HTTP endpoint for integration testing without production credentials, the transport layer can be redirected without altering binding code. However, if the mock response omits a default namespace declaration that the real service would include, unmarshalling behavior may become implementation-dependent.
Metro and EclipseLink MOXy are reported to differ in whether child elements inherit an implicit namespace from an ancestor when the declaration is absent, causing the same fixture to produce different object graphs. This raises a design question about whether the mock should reproduce the exact namespace structure of the production WSDL or whether the client must be explicitly configured to tolerate missing declarations.
Is the divergence a documented JAXB specification gap, a configurable parser feature, or an artifact of how the mock serializes the SOAP envelope? Which namespace resolution strategy should govern the test fixture when the goal is to mirror production parsing without accessing live credentials?