Java CXF 和 Spring-WS 哪个框架更好?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/297033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which framework is better CXF or Spring-WS?
提问by Kevin
I am in the process of researching/comparing CXF and Spring-WS for web services? I need to function both as a provider and a consumer of WS. In a nutshell, I have been told that Spring-WS is more configurable, but CXF is easier to get up and running. This question is subjective, but will help direct me in my research.
我正在研究/比较 CXF 和 Spring-WS 的 Web 服务?我需要同时作为 WS 的提供者和消费者。简而言之,有人告诉我 Spring-WS 的可配置性更强,但 CXF 更容易启动和运行。这个问题是主观的,但将有助于指导我的研究。
- What experience do you have with either of these frameworks?
- Have you run into any pitfalls with either framework?
- Have you found any useful features provided by either that is possibly not provided by the other?
- 你对这两个框架有什么经验?
- 您是否遇到过任何框架的陷阱?
- 你有没有发现任何一个提供的有用的功能可能不是另一个提供的?
采纳答案by toolkit
I think the biggest difference is Spring-WS is only'contract-first' whilst I believe CXF is normally 'contract-last'.
我认为最大的区别是 Spring-WS只是“合同优先”,而我认为 CXF 通常是“合同最后”。
http://static.springsource.org/spring-ws/sites/1.5/reference/html/why-contract-first.html
http://static.springsource.org/spring-ws/sites/1.5/reference/html/why-contract-first.html
Contract-last starts with Java code, so it is usually easier to get started with.
Contract-last 从 Java 代码开始,因此通常更容易上手。
However, the WSDL it creates tends to be more fragile.
但是,它创建的 WSDL 往往更脆弱。
回答by FoxyBOA
We have an experience with CXFand it's predecessor XFireand I can recommend it as solid, quick (WS creating and executing) and reliable framework.
我们有使用CXF及其前身XFire的经验,我可以推荐它作为可靠、快速(WS 创建和执行)和可靠的框架。
Regarding the issues that you can met with CXF see my post https://stackoverflow.com/questions/289977/recommended-framework-for-java-web-services#290205And I agree with toolkit, that the biggest difference between frameworks are ideologically: what is the first code (i.e. interface) or contract (i.e. wsdl). See some details here:
关于您可以使用 CXF 遇到的问题,请参阅我的帖子https://stackoverflow.com/questions/289977/recommended-framework-for-java-web-services#290205我同意工具包,框架之间的最大区别是思想上:什么是第一个代码(即接口)或契约(即wsdl)。在此处查看一些详细信息:
回答by FoxyBOA
CXF does not, in any way, prevent you from starting with a contract (WSDL). I used both of these products to build a web service.
CXF 不会以任何方式阻止您从合同 (WSDL) 开始。我使用这两种产品来构建 Web 服务。
In CXF, I used Maven and the Maven plugin, calling the wsimportgoal to generate the SEI (interface) which I then implemented. After implementing the interface to contain the actual service logic and configuring my bean implementation beans.xml, I then let Maven package it into a war file for deployment. The entire exercise could not have been easier.
在 CXF 中,我使用了 Maven 和 Maven 插件,调用wsimport目标来生成我随后实现的 SEI(接口)。在实现了包含实际服务逻辑的接口并配置了我的 bean 实现beans.xml 之后,我让 Maven 将其打包成一个用于部署的 war 文件。整个练习再简单不过了。
I don't think Spring-WS offers any advantages that outweigh the lack of JAX-WS. CXF already lets you use Spring to wire up your beans and also has a full implementation of JAX-WS as well.
我认为 Spring-WS 没有提供任何超过 JAX-WS 的优势。CXF 已经允许您使用 Spring 来连接 bean,并且还具有 JAX-WS 的完整实现。
回答by Pascal Thivent
About Apache CXF:
关于 Apache CXF:
- CXF supports several standards including SOAP, the WSI Basic Profile, WSDL, WS-Addressing, WS-Policy, WS-ReliableMessaging, WS-Security, WS-SecurityPolicy, and WS-SecureConversation.
- Apache CXF offers both contract-last (starting with Java) and Contract-first (starting with the WSDL) approaches.
- Apache CXF implements JAX-WS and JAX-RS.
- CXF 支持多种标准,包括 SOAP、WSI 基本配置文件、WSDL、WS-Addressing、WS-Policy、WS-ReliableMessaging、WS-Security、WS-SecurityPolicy 和 WS-SecureConversation。
- Apache CXF 提供契约最后(从 Java 开始)和契约优先(从 WSDL 开始)方法。
- Apache CXF 实现了 JAX-WS 和 JAX-RS。
About Spring WS:
关于 Spring WS:
- Spring WS offers "only" contract-first, starting from an XSD Schema.
- Spring WS supports SOAP, WS-Security, WS-Addressing.
- Spring WS 提供“仅”契约优先,从 XSD 模式开始。
- Spring WS 支持 SOAP、WS-Security、WS-Addressing。
So, at the end, I see Spring WS as a minimalweb services framework but consider that it doesn't (in my opinion) have any advantages over Apache CXF (which integrates extremely well with Spring). Between both, I'd pick up Apache CXF.
所以,最后,我认为 Spring WS 是一个最小的Web 服务框架,但考虑到它(在我看来)与 Apache CXF(它与 Spring 的集成非常好)相比没有任何优势。在两者之间,我会选择 Apache CXF。
回答by Shameer Kunjumohamed
Please take a look at a related post at : Building a web service with Spring-WS
请查看以下相关帖子:使用 Spring-WS 构建 Web 服务