Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This tutorial will take you through the steps that are most commonly involved in porting a Web Service from JAX-RPC to JAX-WS. This tutorial does not go into details on why these changes are required and the concepts behind it; it is rather a quick note that helps you to deal with migrating your application from the older Web service stack to new stack.

Even though JAX-RPC is still supported in Java EE 5, it lacks many advanced features that JAX-WS has like Annotations, JAXB Binding, SOAP 1.2, RESTful Services and so on. So, it is strongly recommended that you use JAX-WS instead of JAX-RPC for implementing Web Services in Java.

...

...

JAXB migration

The most notable change in JAX-WS 2.0 is the use of JAXB 2.0 for data-binding between Java and XML. JAX-RPC 1.0 specified a limited mapping between XML and Java.
This effectively eliminates the need of using JAX-RPC mapping file where we define the mapping between Java and WSDL, but also imposes a condition that the return and request values can be able to bind to JAXB. Again, considering the wide variety of data types supported by JAXB it shouldn't be a problem.

...

JAX-RPC didn't used JAXB because the first version of JAX-RPC

...

was completed much before JAXB. So, instead of waiting for JAXB to complete JAX-RPC writers developed their own custom mapping.

...

As per JAX-RPC a Service Endpoint Interface must extend Remote. JAX-WS removes this condition and you can pretty much make a POJO class a Web Service by just adding the @WebService annotation at the top of the class.

...

...

The main differences that you can find here are:

  • Annotations - JAX-WS requires that all SEIs include the @WebService annotation
  • java.rmi.Remote - The JAX-RPC SEI extends the java.rmi.Remote interface. JAX-WS no longer requires this.

...

The following code samples demonstrate the difference between JAX-RPC and JAX-WS in client port lookup.

...

...

The main differences we can observe here are

  • The creation of ServiceFactory instance is no longer required for creating the Service
  • Service maps to javax.xml.rpc.Service in JAX-RPC and to javax.xml.ws.Service in JAX-WS.

RESTful services

JAX-WS introduced introduces RESTful Web Services as successor for SOAP based Web Service. RESTful services have already got quite support from many vendors like Google AdSense, Yahoo API's, Amazon and so on.
The important things that are introduced in JAX-WS to support RESTful services are:

...

JAXWS 2.0 brings in support for optimized transmission of binary data as specified by MTOM (SOAP Message Transmission Optimization Mechanism) and SAAJ (SOAP with Attachments API for Java).
MTOM allows optimized transmission of binary data - any xs:base64Binary or xs:hexBinary schema type can be send sent as attachment following rules defined by MTOM specification.

...