【问题标题】:Apache CXF mustUnderstand boolean vs integerApache CXF mustUnderstand boolean vs integer
【发布时间】:2017-07-14 22:30:01
【问题描述】:

我正在使用 Apache CXF 3.1.12(使用 springboot)开发一个 soap 1.1 服务

我试图了解如何强制它生成 mustUnderstand 标头作为整数 (0|1) 而不是布尔值 (true|false)。请参阅下面的错误文档。据我了解,在肥皂 1.1 中,真/假是不可接受的。无论如何,我的客户不喜欢它,我无法控制他们。

<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>

这是一个 WSDL 优先的服务,并且在 WSDL 中没有提到 SOAP 1.2 命名空间。我的包裹信息是:

@javax.xml.bind.annotation.XmlSchema(namespace = "http://...", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

我的端点是通过以下方式创建的:

EndpointImpl endpoint = new EndpointImpl(bus,
                 new MyClass(), SOAPBinding.SOAP11HTTP_BINDING);

我使用 hdr->setMustUnderstand(true) 在 Phase.WRITE 的 AbstractSoapInterceptor 中修改了 mustUnderstand 标头,但它仍然作为布尔值输出。

JIRA 中有一个老问题,很久以前就标记为已修复:https://issues.apache.org/jira/browse/CXF-2213?jql=text%20~%20%22mustUnderstand%22

任何帮助将不胜感激。

【问题讨论】:

    标签: java spring-boot soap cxf


    【解决方案1】:

    我设法通过在拦截器中强制响应为 SOAP 1.1 响应来解决此问题,方法是:

    final SoapVersion soap11 = Soap11.getInstance();
    message.setVersion(soap11);
    

    我怀疑这是正确的方法,我不确定为什么它坚持认为它不是 SOAP 1.1 消息。但这至少解决了上面的具体问题,并且可以让我继续进行,直到找到正确的方法。

    【讨论】:

      猜你喜欢
      • 2012-07-07
      • 1970-01-01
      • 1970-01-01
      • 2015-05-25
      • 1970-01-01
      • 2011-08-08
      • 2013-08-02
      • 1970-01-01
      • 2014-07-23
      相关资源
      最近更新 更多