如何让 JAX-WS 端点接受 SOAP1.2 消息

Rog*_*ger 4 soap wsdl cxf jax-ws spring-boot

我有一个基于 Spring Boot 的项目,它使用 CXF 来构建 SOAP Web 服务。

发送 SOAP 1.1 消息(使用 SOAPUI)工作正常,但是当我尝试发送 SOAP 1.2 消息(当然使用相同的 WSDL)时,我收到了消息"A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint"。该消息是自我解释的,但我不明白为什么我的端点不接受 1.2 消息。

我的 WSDL 包含soap12 的正确绑定和命名空间。

在我的 spring @Configuration 类中,我将它添加到 CXF 端点 bean:

    endpoint.setBindingConfig(new BindingConfiguration()
    {
        @Override
        public String getBindingId()
        {
            return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
        }
    });
Run Code Online (Sandbox Code Playgroud)

那没有帮助。当我变得更加绝望时,我尝试了@BindingType@SOAPBinding注释当然不起作用,然后我尝试SaajSoapMessageFactorySoapVersion.SOAP_12. 没用。我<extension>true</extension><protocol>Xsoap1.2</protocol>在我的jaxws-maven-plugin. 失败的。

端点显然没有配置为接收 SOAP 1.2 消息。我如何实现这一目标?

Rog*_*ger 5

我想到了。我需要在实现端点时设置绑定 url。由于一些不明显的原因,之后设置它不起作用。

EndpointImpl endpoint = new EndpointImpl(springBus(), statusService(), SOAPBinding.SOAP12HTTP_BINDING);
Run Code Online (Sandbox Code Playgroud)