Java Web服务框架/库,这是一个更好的,为什么? [英] Java Web Service framework/library, which is a better one and why?

查看:124
本文介绍了Java Web服务框架/库,这是一个更好的,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在评估Java中的Web服务框架的数量。我需要Web服务框架来帮助我公开在JBoss上运行的应用程序的一些功能。该应用程序大部分是使用Spring和POJO(没有EJB)开发的。



什么我需要的是一个具有以下属性的框架:


  1. 它应该提供自动生成样板代码的工具,并通过消除重复性任务来节省时间,使用Java生成WSDL的示例工具(java2wsdl),生成端点的工具等。
  2. 应用程序应该很容易部署在现有的J2EE平台(JBoss)上,这意味着它应该尽可能少地包含配置文件(如axis2框架中的axis2.xml)。


    • 此外,还可以在现有应用程序的 .war 存档中部署Web服务。 (看起来Axis2需要Web服务应用程序的单独存档)。

    • 使用 POJO Spring
    • 通常,框架应该具有清晰的结构和设计(例如Spring-WS缺少它),良好的文档和其他任何特性来描述优秀的软件。 >
    • 框架最好包含一些标准功能,如 JAX-WS 等,而不是特定于供应商的方法。 li>

我已经简要地检查了


  • Axis2 li>
  • Apache CXF

  • 和Sun's Metro

  • Spring WS



但是在我的案例中仍然很难决定使用什么:


  • Axis2似乎如此低的级别,它需要单独的应用程序存档和大量的配置

  • Spring WS似乎太不透明,并且复杂的用于展示目的(?)

  • Apache CXF和Metro可能是我更喜欢选择的两个框架,但仍然是


我需要您的意见以及在实际应用中使用其中一些的经验。

解决方案

我已经使用CXF的先行者XFire了一段时间,并且它还不错。当时,我们从Axis迁移出来主要有两个原因:性能和开发难度。当时(不知道现在是否是这样),XFire的性能比其他任何东西都好,并且使用注释驱动开发,而不必运行存根生成,真的很容易添加新的web服务。

CXF看起来更像是相同但更好 - 由于开发时间的限制,我们还没有迁移,也没有迫切的理由这样做(加上6-12个月前相对缺乏文件并不太令人鼓舞)。此外,我还没有真正评估最近的市场,所以我不能告诉你CXF如何与其当代竞争对手相提并论。

关于你的观点:


  1. 没有生成样板代码,WSDL是从服务类的注释自动创建的,并由服务器发布。

  2. Tomcat中的部署相对简单。只需在web.xml中定义另一个servlet并将URL模式映射到此servlet即可。

  3. 我们的Web服务部署在WAR文件中,我不确定实际上有哪些替代方法,但是这似乎是做到这一点的默认和显而易见的方式。

  4. POJO最初工作正常;我们现在已经将大部分Web服务对象创建转移到Spring,以便连接更复杂的条件依赖项,并且没有任何问题。
  5. 文档是CXF最初的弱点,虽然刚刚看了一下,现在看起来好多了。总体设计和架构似乎相对理智;插入自己的过滤器来修改传输细节并不是很痛苦,并且扩展现有的类通常已经被考虑(例如,明智的方法被标记为受保护的而不是私有的)。

  6. JAX -WS在CXF中是完全支持的。

所以我可能有点公正,因为我没有尝试其他的,但我会竖起大拇指来看看CXF。这很快,相对简单,如果你需要调整它,它的功能相当强大。


Currently I am evaluating number of web service frameworks in Java. I need web service framework that will help me to expose some functionality of existent application running on JBoss, The application is mostly developed using Spring and POJOs (no EJBs).

What I need is a framework having following properties:

  1. It should provide tools for automatic generation of boilerplate code and save time by eliminating repetitive tasks, for example tools generating WSDL from Java (java2wsdl), tools generating endpoints etc.
  2. Applications should be easily deployed on existent J2EE platform (JBoss), this means that it should contain as less as possible configuration files (like axis2.xml in axis2 framework).
    • Also it is preferred to be able to deploy web service within .war archive of existent application. (it seems that Axis2 need a separate archive for web service app.)
    • It will be very cool to use a combination of POJOs and Spring.
    • Generally, the framework should have clean structure and design (for example Spring-WS lacks it), good documentation and whatever else characterizes a good piece of software.
    • It is preferred that framework incorporates some standard features like JAX-WS etc. instead of vendor specific methods.

I have briefly examined

  • Axis2
  • Apache CXF
  • and Sun's Metro
  • Spring WS

But still it is difficult to decide what to use in my case:

  • Axis2 seems to be so low level, it requires separate application archive and lots of configurations
  • Spring WS seems to be too opaque and "sophisticated for impression purposes (?)"
  • Apache CXF and Metro probably are two frameworks that I prefer to chose from but still

I need your opinion and experience about usage of some of them in a real-world applications.

解决方案

I've used CXF's forerunner, XFire, for a while now and it's not been too bad. At the time, we migrated from Axis for two major reasons: performance and ease of development. At the time (don't know if this is true now), the performance of XFire was much better than anything out there, and with annotation-driven development, instead of having to run stub generation, it was really really easy to add new web services.

CXF seems to be more of the same but better - we haven't migrated yet due to constraints on development time as well as not having a pressing reason to do so (plus the relative lack of documentation 6-12 months ago wasn't too encouraging). Additionally I haven't really evaluated the market of late, so I can't tell you how CXF stands up to its contemporary competitors.

Regarding your points:

  1. There is no boilerplate code to be generated, the WSDL is automatically created from the service class' annotations and published by the server.
  2. Deployment in Tomcat was relatively simple. Just define another servlet in web.xml and map a URL pattern to this servlet.
  3. Our web services were deployed in WAR files, I'm not sure what the alternatives are in fact but this seemed to be the default and obvious way to do it.
  4. POJOs work fine initially; we've now moved most of the web service object creation to Spring in order to wire more complex conditional dependencies in and have had no problems with this.
  5. Documentation was a weak point with CXF originally, though having just had a look it seems to be better now. The general design and architecture seems relatively sane; slotting in one's own filters to modify the transmission details was not very painful, and extending existing classes has generally been considered (so sensible methods are marked protected instead of private, for example).
  6. JAX-WS is full supported in CXF.

So I'm probably a little impartial as I haven't tried the other ones, but I'll give a thumbs up to having a look at CXF. It's pretty fast, relatively simple to get going with and fairly powerful if you need to tweak it.

这篇关于Java Web服务框架/库,这是一个更好的,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆