JAX-RPC and JAX-WS

Source: Internet
Author: User

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 Java to write Web Services. In this case, JAX-RPC 1.0 came into being. After several months of use, the Java Community process (JCP) staff who compiled this specification realized that some adjustments were needed and the result was JAX-RPC 1.1. The specification was used about a year later, and the JCP staff wanted 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 also use message-oriented web services. Therefore, the "RPC" is removed from the name and replaced by "ws" (Web Services ). So later 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 out of favor in the Web service community. WS-I basic profile does not support it. Therefore, soap encoding is no longer allowed for the JAX-WS, which is the latest version of the Java Web service. The JAX-RPC supports soap encoding, so if you really need to use a message that uses soap encoding, 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 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. HTTP 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 then, 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 profiles. In most cases, the difference does not affect the Java programming model. Except attachments. The WS-I not only handles some issues with attachments, 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. In particular, the support for soap with attachments (SW/a) is still quite unclear. In the second working cycle, the WS-I staff separated the attachment from the basic summary (BP 1.1) and supplemented some of the 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 simple soap
Simple soap binding profile. The description does not support Sw/a web service engines (such as Microsoft. 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 the Java 5 link in references.

Summary

JAX-WS 2.0 is a later version of JAX-RPC 1.1. 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, this series of articles on the difference between JAX-WS and JAX-RPC are discussed in detail, we will release it in the next few months. In general, it may be decided to migrate from the JAX-RPC to the JAX-WS or remain unchanged for the following reasons.

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.

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.