JAX-WS 简介

JAX-WS规范是一组XML web services的JAVA API。
JAX-WS允许开发者可以选择RPC-oriented或者message-oriented 来实现自己的web services。

在 JAX-WS中,一个远程调用可以转换为一个基于XML的协议例如SOAP。
在使用JAX-WS过程中,开发者不需要编写任何生成和处理SOAP消息的代码。
JAX-WS的运行时实现会将这些API的调用转换成为SOAP消息。
在服务器端,用户只需要通过Java语言定义远程调用所需要实现的接口SEI (service endpoint interface),并提供相关的实现,通过调用JAX-WS的服务发布接口就可以将其发布为WebService接口。
在客户端,用户可以通过JAX-WS的API创建一个代理(用本地对象来替代远程的服务)来实现对于远程服务器端的调用。

JAX-WS的API有两个层次,除了常见DataBinding后调用最终Java方法外,
还可以使用客户端的Dispatch与服务端Provider接口,绕过DataBinding处理,直接处理XML。

参考文档:http://jnn.iteye.com/blog/83103

 

Reasons you might want to use CXF:
1. JAX-WS Support
2. Spring Integration
3. Aegis Databinding
Aegis Databinding (2.0.x) is our own databinding library that makes development of code-first web services incredibly easy.
Unlike JAXB, you don't need annotations at all.
4. RESTful services
CXF enables the development of RESTful services via annotations using the HTTP Binding.
5. WS-* Support
CXF supports a variety of web service specifications including WS-Addressing, WS-Policy, WS-ReliableMessaging and WS-Security.

 

JAX-WS由来

Web 服务已经出现很久了。首先是 SOAP,但 SOAP 仅描述消息的情况,然后是 WSDL,WSDL 并不会告诉您如何使用 Java™ 编写 Web 服务。在这种情况下,JAX-RPC 1.0 应运而生。经过数月使用之后,编写此规范的 Java Community Process (JCP) 人员认识到需要对其进行一些调整,调整的结果就是 JAX-RPC 1.1。该规范使用大约一年之后,JCP 人员希望构建一个更好的版本:JAX-RPC 2.0。其主要目标是与行业方向保持一致,但行业中不仅只使用 RPC Web 服务,还使用面向消息的 Web 服务。因此从名称中去掉了“RPC”,取而代之的是“WS”(当然表示的是 Web 服务)。因此 JAX-RPC 1.1 的后续版本是 JAX-WS 2.0——Java API for XML-based Web services。

(http://www.ibm.com/developerworks/cn/webservices/ws-tip-jaxwsrpc.html)

Why two standard Java web services APIs?
JAX-RPC 1.1 is the standard web service API in J2EE 1.4. As its name indicates, it focuses on RPC bindings, which became less and less popular in the past couple of years. As a consequence, it has been superseded by JAX-WS 2.0 in Java EE 5, being more flexible in terms of bindings but also being heavily annotation-based. JAX-WS 2.1 is also included in Java 6 (or more specifically, in Sun's JDK 1.6.0_04 and above; previous Sun JDK 1.6.0 releases included JAX-WS 2.0), integrated with the JDK's built-in HTTP server. Spring can work with both standard Java web services APIs. On Java EE 5 / Java 6, the obvious choice is JAX-WS. On J2EE 1.4 environments that run on Java 5, you might have the option to plug in a JAX-WS provider; check your Java EE server's documentation.

(Reference from spring-framework-reference.pdf )

posted @ 2011-12-19 22:34  万法自然~  阅读(706)  评论(0编辑  收藏  举报