简体   繁体   English

如何使用Apache CXF禁用SOAP 1.1绑定

[英]How to disable SOAP 1.1 binding with Apache CXF

In a Java/Spring/Apache CXF application, I have a SOAP endpoint defined like this: 在Java / Spring / Apache CXF应用程序中,我具有如下定义的SOAP端点:

<cxf:endpoint
    id="MessagingService"
    address="/MessagingService"
    bindingUri="http://www.w3.org/2003/05/soap/bindings/HTTP/"
    implementor="mypackage.MessagingServiceImpl" />

The attribute bindingUri="http://www.w3.org/2003/05/soap/bindings/HTTP/" enables SOAP 1.2 bindings. 属性bindingUri="http://www.w3.org/2003/05/soap/bindings/HTTP/"启用S​​OAP 1.2绑定。 I've tested, it works. 我已经测试过,它可以工作。

Some people considers there is a security issue with SOAP 1.1 by "expanding XML entities". 有人认为通过“扩展XML实体”可以解决SOAP 1.1的安全问题。 I would like to protect my WebService from this kind of attack. 我想保护我的WebService免受这种攻击。

Not sure my question makes sense but: is it possible to "disable" SOAP 1.1 binding? 不确定我的问题是否有意义,但是:是否可以“禁用” SOAP 1.1绑定?

NB: from my perspective, what makes the difference between SOAP 1.1 and SOAP 1.2 requests is the XML namespace http://schemas.xmlsoap.org/soap/envelope/ used in SOAP 1.1 requests and http://www.w3.org/2003/05/soap-envelope used in SOAP 1.2 requests. 注意:从我的角度来看,SOAP 1.1和SOAP 1.2请求之间的区别是SOAP 1.1请求和http://www.w3.org/2003/05/soap-envelope使用的XML名称空间http://schemas.xmlsoap.org/soap/envelope/ SOAP 1.2请求中使用的http://www.w3.org/2003/05/soap-envelope "Disabling" SOAP 1.1 binding could mean: reject any SOAP request using the SOAP 1.1 namespace “禁用” SOAP 1.1绑定可能意味着:使用SOAP 1.1名称空间拒绝任何SOAP请求。

Thanks in advance 提前致谢

You would need to add an interceptor that would check the soap version and throw a fault. 您将需要添加一个拦截器,该拦截器将检查肥皂版本并引发故障。

That said, I really don't understand your concern. 就是说,我真的不明白您的担心。 Within CXF, both versions are processed exactly the same. 在CXF中,两个版本的处理方式完全相同。 Any security issue with 1.1 would also be present with 1.2. 1.1的任何安全性问题也将出现在1.2中。 Thus, it wouldn't get you any benefits to do so. 因此,这样做不会给您带来任何好处。

I'm not exactly sure what you are referring to about the "expanding XML entities", but it's likely one of two things: 我不确定您指的是“扩展的XML实体”,但这很可能是两件事之一:

1) XML DTD entity expansion - this is an XML level thing that would affect both 1.1 and 1.2. 1)XML DTD实体扩展-这是XML级别的东西,会影响1.1和1.2。 However, CXF turns that off at the parser level. 但是,CXF在解析器级别将其关闭。

2) SOAP encoding structure loops and such which WOULD be SOAP 1.1, but CXF doesn't support soap encoding, so also not an issue. 2)SOAP编码结构循环以及将是SOAP 1.1的循环,但是CXF不支持soap编码,因此也不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM