Web Service tips and tips: Comparison of JAX-RPC and JAX-WS

Source: Internet
Author: User
Tags websphere application server wsdl

JAX-WS 2.0 is a later version of JAX-RPC 1.1. This article will introduce a series of articles comparing the two Java Web Service programming models.


Introduction

Web services have been around for a long time. The first is soap, but soap only describes the message, followed by WSDL. WSDL does not tell you how to use
Write Web Services in Java. In this case, JAX-RPC 1.0 came into being. After several months of use, write Java Community for this specification
The process (JCP) staff realized the need to make some adjustments and the result was JAX-RPC 1.1. This specification is used about one year later, JCP
People want to build a better version: JAX-RPC 2.0. Its main goal is to be consistent with the industry direction, but the industry not only uses RPC web services, but also uses message-oriented
Web service. Therefore, the "RPC" is removed from the name and replaced by "ws" (Web Services ). So subsequent versions of JAX-RPC 1.1 are
JAX-WS 2.0 -- Java API for XML-based Web Services.

What remains unchanged?

Before listing the differences between JAX-RPC 1.1 and JAX-WS 2.0, we should first discuss the similarities between them.

  • The JAX-WS still supports soap 1.1 over HTTP 1.1, so interoperability will not be affected and the same message can still be delivered online.
  • The JAX-WS still supports WSDL 1.1, so the knowledge you have learned about this specification is still useful. The WSDL 2.0 specification is nearing completion, but its work is still in progress at the end of work related to JAX-WS 2.0.

What is the difference?

  • HTTP 1.2

    Both JAX-RPC and JAX-WS support soap 1.1. The JAX-WS also supports soap 1.2.

  • XML/HTTP

    The WSDL 1.1 specification is defined in HTTP binding, which means that XML messages can be sent over HTTP without soap. The JAX-RPC ignores the HTTP binding. The JAX-WS has added support for it.

  • WS-I basic profile

    JAX-RPC supports WS-I basic profile (BP) V1.0. JAX-WS supports BP 1.1. (WS-I is the Web Service interoperability organization .)

  • New Java features
    • The JAX-RPC maps to Java 1.4. The JAX-WS maps to Java 5.0. JAX-WS depends on many new features in Java 5.0.
    • Java ee 5 is a later version of J2EE 1.4 that adds support for JAX-WS, but still supports JAX-RPC, which can be confusing for new Web Services.
  • Data ing model
    • The JAX-RPC has its own ing model that covers about 90% of all schema types. It does not cover the part mappedjavax.xml.soap.SOAPElement
      .
    • The data ing model for the JAX-WS is jaxb. Jaxb ensures the ing of all XML modes.
  • Interface ing model

    The basic interface ing model of JAX-WS is not very different from the JAX-RPC, but there are the following differences between them:

    • The model of the JAX-WS uses the new Java 5.0 feature.
    • The JAX-WS model introduces the asynchronous function.
  • Dynamic Programming Model
    • The dynamic client model of the JAX-WS differs significantly from that of the JAX-RPC. Many changes are made to recognize the needs of the industry:

      • Message-oriented functions are introduced.
      • The dynamic asynchronous function is introduced.
    • The JAX-WS also adds a dynamic server model, which is not available in the JAX-RPC.
  • Message transmission optimization mechanism (MTOM)

    The JAX-WS added support for the new attachment specification MTOM through jaxb. Microsoft has never added an attachment specification to soap; however, it seems that everyone supports MTOM, so attachment interoperability should be achieved.

  • Handler Model
    • From JAX-RPC to JAX-WS, the processing program model has undergone great changes.
    • The JAX-RPC processor depends on SAAJ 1.2. JAX-WS processors rely on the new SAAJ 1.3 specification.

For the rest of this article, we will discuss soap 1.2, XML/HTTP, WS-I basic profiles, and Java 5. The remaining five parts will be discussed separately in this series of technical articles.

Soap Encoding


Soap encoding is already out of favor in the Web service community. WS-I basic profile does not support it. Therefore, as the latest version of Java Web service
The JAX-WS no longer allows soap encoding. JAX-RPC supports soap encoding, so if you really need to use soap
For encoded messages, still use Jax-RPC.

HTTP 1.2

From the programming model perspective, there is not much difference between soap 1.1 and soap 1.2. As a Java programmer, you will only encounter these differences when using the processing program. We will discuss how to handle this situation in future technical articles. SAAJ 1.3 has been updated to support soap 1.2.

XML/HTTP

Similar to soap 1.2 changes, there are not many differences between soap/HTTP and XML/HTTP messages from the programming model perspective. As
Java programmers, you will only encounter these differences when using the processing program, and we will discuss how to handle this situation in future technical articles. HTTP
The binding has its own handler chain and a set of message context attributes.

WS-I Basic Profiles

JAX-RPC 1.1 supports WS-I basic profile (BP) 1.0. Since that time, WS-I staff have completed BP
1.1 (and associated AP 1.0 and ssbp 1.0) development. These new summaries clarify some minor points and define attachments more clearly. JAX-WS 2.0
Supports these newer summaries. In most cases, the difference does not affect the Java programming model. Except attachments. WS-I
It not only handles some attachment problems, but also defines its own XML attachment type: WSI: swaref.

Many people are confused about these issues. To find out the problem, you need to know the relevant history.

The first basic outline of WS-I (BP 1.0) was doing very well in clarifying the specifications, but it was not perfect. Especially for soap
The support for attachments (SW/a) is still quite unclear. In the second working cycle, the WS-I staff moved the attachment from the basic summary (BP 1.1)
And supplement some content not discussed in the first version. At that time, they added two basic summary documents not included: AP 1.0 and ssbp 1.0. AP
1.0 is the attachment profile, which describes how to use Sw/. Ssbp 1.0 is a summary of simple soap binding.
(Simple soap binding profile), description does not support Sw/a web service engine (such as Microsoft's
. Net ). Other profiles provided by the WS-I are built on these basic profiles.

Java 5

A series of changes were made to the Java language. JAX-WS depends on: annotation, common functions, and execution programs. We will discuss in subsequent technical articles how JAX-WS depends on this new feature. For more information about these new functions of Java, see references.
Java 5 link in.

Summary

JAX-WS 2.0 is JAX-RPC 1.1
Later versions. Some of the content remains unchanged, but most programming models are more or less different. The topic introduced in this article will be discussed in a series of technical articles.
The differences between JAX-WS and JAX-RPC are discussed in detail and will be released in the next few months. In general, it may be determined from
The JAX-RPC is migrated to the JAX-WS, or remains unchanged.

Reasons for continuing to use JAX-RPC 1.1:

  • If you want to continue using the existing stuff, the JAX-RPC will continue to be supported for some time to come.
  • If you do not want to upgrade to Java 5.
  • If you want to send a soap-encoded message or create a rpc/encoded-style WSDL.

Reason for upgrading to JAX-WS 2.0:

  • If you want to use a new message-oriented API.
  • If you want to use MTOM to send the attachment data.
  • If you want to use jaxb to better support the XML mode.
  • If you want to use the asynchronous programming model in the Web service client.
  • If you want to use a client or service that can process soap 1.2 messages.
  • If you want to eliminate soap requirements in Web Services, bind them directly using XML/HTTP.
  • If you prefer advanced cutting-edge technologies.

References

Learning

  • For more information, see the original article on the developerworks global site.
    .
  • Obtain JAX-RPC 1.1
    And javadoc.
  • Obtain JAX-WS 2.0
    And javadoc.
  • Obtain jaxb 2.0
    And javadoc.
  • Java 5
    .
  • Read the WSDL 1.1 Specification
    .
  • Read soap v1.2 Primer
    .
  • Read MTOM specifications
    .
  • Read the soap with attachments Specification
    .
  • Visit the WS-I's website
    .
  • Learn about the latest developerworks technical events and network broadcasts
    .
  • You can use IBM WebSphere Application Server Version 6.1 Feature Pack for Web Services
    The beta version to start evaluating JAX-WS functionality.

Obtain products and technologies

  • Use IBM trial software
    Develop your next project and download the trial software from developerworks.

Author Profile

Russell
Butek is an SOA and Web Service consultant from IBM. He was one of the developers of IBM WebSphere web service engine. He is also
A member of the Java specification request (JSR) expert group for JAX-RPC. He participated in Apache's axis soap
Engine implementation, and push axis 1.0 to comply with Jax-RPC.

 

Nick Gallardo
As a software engineer for the IBM WebSphere platform, he is responsible for all aspects of web service support. Prior to this, he was engaged in IBM WebSphere and
Other work in Tivoli platform. Nick joined IBM in 2001 and previously worked in development at two different start-up technology companies in Ostin, Texas.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.