当发送一些额外的属性时,将 CXF 与 Spring Java 配置一起使用时出现解组错误(但使用 XML 配置时没有错误)

Unmarshalling error whan using CXF with Spring Java Config, when some extra properties are sent (but no error when using XML config)

我有一些奇怪的问题。

我们有一个 WSDL 并从中生成 JAXB 代码。服务的第一次部署使用 Spring XML 配置,我们将端点配置为

<jaxws:endpoint id="paymentProcess"
    implementor="com.path.implementation.class"
    address="/paymentProcess"/>

客户端系统不知不觉地向其中一个 Web 方法请求添加了一个 属性(一个 xml 元素),但此代码中没有任何反应。它忽略了额外的 属性.

但现在我已经使用 JavaConfig 更改了代码

@Bean("cxf")
public SpringBus springBus() {
    System.setProperty("org.apache.cxf.logging.enabled", "pretty");
    return new SpringBus();
}

@Bean
public Endpoint paymentServiceEndpoint(InstallmentServicesImpl installmentServices) {
    EndpointImpl endpoint = new EndpointImpl(springBus(), installmentServices);
    endpoint.publish("/paymentProcess");
    return endpoint;
}

这次改动后,我们遇到了很多问题,经过一番努力,我们发现客户端发送了一个额外的 属性 (一个 xml 元素),这在最初的 WSDL 中是没有的,并且由于发生了解组错误。

有什么方法可以让 CXF 忽略这些额外的元素吗?

问题出在我的 JDK 和 CXF 版本上,目标系统部署在 JDK 6 上,这让我将 CXF 降级到 3.0 版。一切顺利。