Java Apache CXF必须理解布尔值与整数
我正在使用ApacheCXF3.1.12(使用springboot)开发soap 1.1服务 我试图理解如何强制它将mustUnderstand头生成为整数(0 | 1)而不是布尔值(true | false)。请参阅下面的错误文档。据我所知,在soap 1.1中,true/false是不可接受的。不管怎样,我的客户不喜欢,我也无法控制他们Java Apache CXF必须理解布尔值与整数,java,spring-boot,soap,cxf,Java,Spring Boot,Soap,Cxf,我正在使用ApacheCXF3.1.12(使用springboot)开发soap 1.1服务 我试图理解如何强制它将mustUnderstand头生成为整数(0 | 1)而不是布尔值(true | false)。请参阅下面的错误文档。据我所知,在soap 1.1中,true/false是不可接受的。不管怎样,我的客户不喜欢,我也无法控制他们 <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="true">http://...</a:Action>
</s:Header>
<s:Body>
...
</s:Body>
</s:Envelope>
我的端点是通过以下方式创建的:
EndpointImpl endpoint = new EndpointImpl(bus,
new MyClass(), SOAPBinding.SOAP11HTTP_BINDING);
我在Phase.WRITE with hdr->setMustUnderstand(true)修改了AbstractSoapInterceptor中的mustUnderstand头,但它仍然作为布尔值输出
JIRA中有一个关于这一点的老问题,很久以前就被标记为已修复:
如果有任何帮助,我们将不胜感激。我成功地解决了这一问题,通过以下方式在拦截器中强制响应为SOAP 1.1响应:
final SoapVersion soap11 = Soap11.getInstance();
message.setVersion(soap11);
我怀疑这是正确的方式,我不知道为什么它坚持认为这不是SOAP1.1消息。但这至少解决了上述特定问题,并允许我继续进行,直到找到正确的方法。我通过以下方式将响应强制为拦截器中的SOAP 1.1响应来解决此问题:
final SoapVersion soap11 = Soap11.getInstance();
message.setVersion(soap11);
我怀疑这是正确的方式,我不知道为什么它坚持认为这不是SOAP1.1消息。但这至少解决了上述具体问题,并将允许我继续进行,直到找到正确的方法