`
月迷津渡
  • 浏览: 102209 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Web service main idea(转自IBM)

    博客分类:
  • Java
阅读更多

Introduction

Web services have been around a while now. First there was SOAP. But SOAP only described what the messages looked like. Then there was WSDL. But WSDL didn't tell you how to write web services in Java™. Then along came JAX-RPC 1.0. After a few months of use, the Java Community Process (JCP) folks who wrote that specification realized that it needed a few tweaks, so out came JAX-RPC 1.1. After a year or so of using that specification, the JCP folks wanted to build a better version: JAX-RPC 2.0. A primary goal was to align with industry direction, but the industry was not merely doing RPC web services, they were also doing message-oriented web services. So "RPC" was removed from the name and replaced with "WS" (which stands for web Services, of course). Thus the successor to JAX-RPC 1.1 is JAX-WS 2.0 - the Java API for XML-based web services.

What remains the same?

Before we itemize the differences between JAX-RPC 1.1 and JAX-WS 2.0, we should first discuss what is the same.

  • JAX-WS still supports SOAP 1.1 over HTTP 1.1, so interoperability will not be affected. The same messages can still flow across the wire.
  • JAX-WS still supports WSDL 1.1, so what you've learned about that specification is still useful. A WSDL 2.0 specification is nearing completion, but it was still in the works at the time that JAX-WS 2.0 was finalized.

What is different?

  • SOAP 1.2

    JAX-RPC and JAX-WS support SOAP 1.1. JAX-WS also supports SOAP 1.2.

  • XML/HTTP

    The WSDL 1.1 specification defined an HTTP binding, which is a means by which you can send XML messages over HTTP without SOAP. JAX-RPC ignored the HTTP binding. JAX-WS adds support for it.

  • WS-I's Basic Profiles

    JAX-RPC supports WS-I's Basic Profile (BP) version 1.0. JAX-WS supports BP 1.1. (WS-I is the web services interoperability organization.)

  • New Java features
    • JAX-RPC maps to Java 1.4. JAX-WS maps to Java 5.0. JAX-WS relies on many of the features new in Java 5.0.
    • Java EE 5, the successor to J2EE 1.4, adds support for JAX-WS, but it also retains support for JAX-RPC, which could be confusing to today's web services novices.
  • The data mapping model
    • JAX-RPC has its own data mapping model, which covers about 90 percent of all schema types. Those that it does not cover are mapped to javax.xml.soap.SOAPElement.
    • JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas.
  • The interface mapping model

    JAX-WS's basic interface mapping model is not extensively different from JAX-RPC's; however:

    • JAX-WS's model makes use of new Java 5.0 features.
    • JAX-WS's model introduces asynchronous functionality.
  • The dynamic programming model
    • JAX-WS's dynamic client model is quite different from JAX-RPC's. Many of the changes acknowledge industry needs:
      • It introduces message-oriented functionality.
      • It introduces dynamic asynchronous functionality.
    • JAX-WS also adds a dynamic server model, which JAX-RPC does not have.
  • MTOM (Message Transmission Optimization Mechanism)

    JAX-WS, via JAXB, adds support for MTOM, the new attachment specification. Microsoft never bought into the SOAP with Attachments specification; but it appears that everyone supports MTOM, so attachment interoperability should become a reality.

  • The handler model
    • The handler model has changed quite a bit from JAX-RPC to JAX-WS.
    • JAX-RPC handlers rely on SAAJ 1.2. JAX-WS handlers rely on the new SAAJ 1.3 specification.

In the remainder of this tip, we will discuss SOAP 1.2, XML/HTTP, the WS-I Basic Profiles, and Java 5. Each of the remaining five bullets above will be a separate tip in this series.

SOAP encoding

SOAP encoding has fallen out of favor in the web services community. It is not supported by the WS-I basic profile. So JAX-WS, as the latest incarnation of Java web services, has disallowed SOAP encoding. JAX-RPC supports SOAP encoding, so if you really must use SOAP encoded messages, stick with JAX-RPC.

SOAP 1.2

There is really not a lot of difference, from a programming model point of view, between SOAP 1.1 and SOAP 1.2. As a Java programmer, the only place you will encounter these differences is when using the handlers, which we will cover in a future tip. SAAJ 1.3 has been updated to support SOAP 1.2.

XML/HTTP

Like the changes for SOAP 1.2, there is really not a lot of difference, from a programming model point of view, between SOAP/HTTP and XML/HTTP messages. As a Java programmer, the only place you will encounter these differences is when using the handlers, which we will cover in a future tip. The HTTP binding has its own handler chain and its own set of message context properties.

WS-I's basic profiles

JAX-RPC 1.1 supports WS-I's Basic Profile (BP) 1.0. Since that time, the WS-I folks have developed BP 1.1 (and the associated AP 1.0 and SSBP 1.0). These new profiles clarify some minor points, and more clearly define attachments. JAX-WS 2.0 supports these newer profiles. For the most part, the differences between them do not affect the Java programming model. The exception is attachments. WS-I not only cleared up some questions about attachments, but they also defined their own XML attachment type: wsi:swaRef.

Many people are confused by all these profiles. You will need a little history to clear up the confusion.

WS-I's first basic profile (BP 1.0) did a good job of clarifying the various specs. But it wasn't perfect. And support for SOAP with Attachments (Sw/A) in particular was still rather fuzzy. In their second iteration, the WS-I folks pulled attachments out of the basic profile - BP 1.1 - and fixed some of the things they missed the first time around. At that point they also added two mutually exclusive supplements to the basic profile: AP 1.0 and SSBP 1.0. AP 1.0 is the Attachment Profile which describes how to use Sw/A. SSBP 1.0 is the Simple SOAP Binding Profile, which describes a web services engine that does not support Sw/A (such as Microsoft's .NET). The remaining profiles that WS-I has and is working on build on top of those basic profiles.

Java 5

There are a number of changes to the Java language. JAX-WS relies on: annotations, generics, and executors. We will detail exactly how JAX-WS relies on this new functionality in follow-on tips. For information on these new features of Java, see the Java 5 link in Resources.

Summary

JAX-WS 2.0 is the successor to JAX-RPC 1.1. There are some things that haven't changed, but most of the programming model is different to a greater or lesser degree. The topics introduced in this tip will be expanded upon in a series of tips which we will publish over the coming months that will compare, in detail, JAX-WS and JAX-RPC. At a high level though, here are a few reasons why you would or would not want to move to JAX-WS from JAX-RPC.

Reasons you may want to stay with JAX-RPC 1.1:

  • If you want to stay with something that's been around a while, JAX-RPC will continue to be supported for some time to come.
  • If you don't want to step up to Java 5.
  • If you want to send SOAP encoded messages or create RPC/encoded style WSDL.

Reasons to step up to JAX-WS 2.0:

  • If you want to use the new message-oriented APIs.
  • If you want to use MTOM to send attachment data.
  • If you want better support for XML schema through JAXB.
  • If you want to use an asynchronous programming model in your web service clients.
  • If you need to have clients or services that can handle SOAP 1.2 messages.
  • If you want to eliminate the need for SOAP in your web services and just use the XML/HTTP binding.
  • If you like playing with leading edge technology.

http://hi.baidu.com/wenter126/blog/item/c5d3a754b1772d183a293599.html

分享到:
评论

相关推荐

    idea-IDEA创建Web项目详细过程 - CSDN博客1

    【IDEA创建Web项目详细过程】 IDEA,全称IntelliJ IDEA,是一款广受欢迎的Java集成开发环境,尤其在Web应用开发中有着强大的支持。本文将详细介绍如何使用IDEA创建一个Web项目,并配置Tomcat服务器。 1. **创建Web...

    Axis开发Web Service实例

    ### Axis开发Web Service实例详解 #### 一、概述 在探讨如何使用Apache Axis来开发Web Service之前,我们首先需要了解一些基本概念。 **Web Service**是一种标准的技术框架,用于实现不同平台之间的应用通信。它...

    netbeans 开发 web service

    ### NetBeans 开发 Web Service 知识点详解 #### 一、基础知识介绍 **Web Service** 是一种跨编程语言和操作系统平台的网络应用程序调用机制。它通过HTTP协议来发送和接收XML格式的信息,实现不同应用程序之间的...

    在Pocket PC中使用Web Service连接数据库

    在本文中,我们将探讨如何在Pocket PC设备上利用Web Service技术连接到数据库,这是一种在Windows Mobile 2003平台上实现跨数据库访问的有效方法。在移动应用系统中,特别是掌上应用系统,需要灵活地访问不同类型的...

    Web Service实例(Spring+Hibernate+Web Service)

    - `src/main/java`: 存放源代码,包括Spring配置、业务逻辑、DAO层、Web Service接口和实现。 - `src/main/resources`: 配置文件,如Spring的bean配置、Hibernate的映射文件。 - `pom.xml`: Maven的项目配置文件...

    IDEA main 方法

    在使用IntelliJ IDEA开发Java程序时,常常需要为main方法传递参数,以便测试不同的运行场景。在本文中,我们将详细讨论如何在IDEA中给main方法附带参数,并将其整理成PDF文档,方便保存和查阅。 首先,了解main方法...

    用idea创建的maven web项目

    【标题】"用idea创建的maven web项目"是一个基于IntelliJ IDEA(简称idea)开发工具构建的Maven Web应用程序。Maven是Java领域的一个项目管理和构建工具,它通过提供一套规范化的项目结构和自动化的构建流程,帮助...

    使用Idea14.1.4和maven创建java web项目

    ### 使用Idea14.1.4和Maven创建Java Web项目 #### 一、概述 在本篇文章中,我们将详细介绍如何使用IntelliJ IDEA 14.1.4版本结合Maven来创建一个Java Web项目。这种方法不仅能够提高开发效率,还能确保项目的结构...

    idea创建maven web项目标准结构源码

    在IT行业中,开发Java Web应用时,IntelliJ IDEA(简称Idea)是一款非常流行的集成开发环境,而Maven则是管理项目构建、依赖关系和生命周期的工具。本资源"idea创建maven web项目标准结构源码"提供了一个基础的模板...

    JAVA程序调用Web Service示例过程演示

    在IT领域,尤其是在软件开发与集成的过程中,Java作为一种广泛应用的编程语言,其调用Web Service的能力是连接不同系统和服务的关键技术之一。以下是对“JAVA程序调用Web Service示例过程演示”这一主题的深入解析,...

    基于Axis的Web Service客户端调用

    【标题】基于Axis的Web Service客户端调用 在IT领域,Web Service是一种通过网络进行通信的标准协议,它允许不同系统间的应用程序互相交换数据。而Apache Axis是Java平台上的一个开源工具,专门用于创建和部署Web ...

    动态调用Web Service的例子

    在IT行业中,Web Service是一种基于网络的、松散耦合的软件组件,它允许不同的应用程序之间进行数据交换和功能调用。本示例是关于如何使用C#和.NET Framework 2.0动态调用Web Service的实践应用。下面将详细阐述相关...

    IDEA WEB项目启动不加载application.properties配置文件.docx

    "IDEA WEB项目启动不加载application.properties配置文件" 在本篇文章中,我们将讨论IDEA WEB项目启动不加载application.properties配置文件的问题。这个问题可能是由于项目中使用的SpringBoot版本不一致引起的。...

    asp Web Service 创建调用.rar

    ASP Web Service是微软.NET框架下的一种技术,用于构建可以跨平台、跨网络的Web服务。在本教程中,我们将深入探讨如何创建和调用ASP Web Service,通过提供的"视频--asp Web Service 创建调用.rar"资源,你可以跟随...

    Spring Web Service 实战篇(1)

    【标题】"Spring Web Service 实战篇(1)" 指的是使用Spring框架构建Web服务的实际操作教程。在这个部分,我们将深入探讨如何利用Spring的强大功能来设计和实现基于Web的服务,以便于不同系统间的交互和数据共享。 ...

    text-generation-webui-main

    本文将深入探讨“text-generation-webui-main”项目,这是一个集成了多种模型后端的文本生成Web用户界面,它包括transformers、llama.cpp、ExLlama、AutoGPTQ、GPTQ-for-LaMa以及ctransformers等核心组件,旨在为...

    idea部署eclipse的web项目(tomcat)

    一个标准的Java Web项目通常包含以下几个关键部分:`WEB-INF`目录、`src/main/java`源代码目录、`src/main/resources`资源文件目录以及`webapp`目录,后者包含HTML、CSS、JavaScript等静态文件以及`WEB-INF/web.xml`...

    2.idea创建一个web项目.rar

    4. **配置Web.xml**:在`src/main/webapp/WEB-INF`目录下,IDEA会自动生成`web.xml`文件,这是Web应用的部署描述符,用来配置Servlet、过滤器、监听器等。 5. **Maven或Gradle集成**:IDEA支持通过Maven或Gradle...

    axis开发web service程序

    ### Axis 开发 Web Service 程序详解 #### 一、Web Service 概念与应用场景 Web Service 是一种跨编程语言和操作系统平台的远程调用技术。它允许不同语言编写的程序通过网络进行通信和数据交换。Web Service 的...

Global site tag (gtag.js) - Google Analytics