JAX-WS stands for java API for “XML-based Web Services”.The JAX-RPC2.0 specification will extend JAX-RPC1.1 in a number of different ways.

The JAX-RPC2.0 renamed as JAX-WS2.0.This was done for a number of reasons:

  1. 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”.
  2. The JAX-RPC name is misleading,developers assume that all JAX-RPC is about just RPC ,not web services.by renaming JAX-RPC to JAX-WS we can eliminate this confusion.
  3. JAX-RPC2.0 uses JAXB for all data binding.Migrating from JAX-RPC1.x to JAX-RPC2.0 is very difficult.Hence,these are two separate technologies.
  4. Using JAX-RPC1.0/1.1 APIs are not developer friendly i.e.,using javax.xml.rpc.Service,javax.xml.rpc.Call interfaces are not convenient for developer.JAX-WS introduces new set of APIs(including annotations) which are easier to understand and use.

The successor to JAX-RPC1.1 is JAX-WS2.0- The java API for “XML based Web Services”.

Differences between JAX-RPC 1.1 and JAX-WS 2.0

Scenario JAX-RPC1.0/1.1 JAX-RPC2.0/JAX-WS2.0
Data Mapping model
Defines its own type mapping for serialization and deserialization of XML types to and from java types,which covers 90% of the all XML types.Those that it does not cover are mapped to javax.xml.soap.SOAPElement.This version does not require he use of JAXB JAX-RPC2.0 strongly aliged with JAXB2.0,effectively delegating to the JAXB2.0 for all data binding related tasks
Message Format SOAP over HTTP[soap binding] SOAP over HTTP[SOAP binding]&XML over HTTP[http binding]
J2EE&JDK version J2EE1.4 &JDK1.4 Java EE5 and JDK1.5
SOAP version SOAP1.1 SOAP 1.1 and SOAP 1.2
WSDL version WSDL1.1 WSDL 1.1 and WSDL 2.0
Basic profile 1.0 1.1
Annotation Support NO YES
Message Style Rpc-style Both RPC and Document style
Encoding Style Literal and soap encoding Only literal encoding
Note:soap encoding causes interperbility issues according to WS-I Basic Profile
MTOM(Message Transmission Optimization Mechanism) No YES
Handler Rely on SAAJ 1.2 Rely on SAAJ 1.3
  1. The JAX-RPC defined its own java/XML binding,but the JAX-WS2.0(the successor to JAX-RPC)no longer defines a java/XML binding,rather JAX-WS delegates type mapping to JAXB.
  2. The delegation of java/XML binding to JAXB2.0 greatly improves the usability of JAX-WS as compared with JAX-RPC.
  3. The JAX-WS supports two most popular WS-1 compliant WSDL styles:rpc/literal,document/literal.
  4. The JAX-WS supports both SOAP over HTTP[soap binding] and XML over HTTP [http binding].
  5. SOAP over HTTP[soap binding] means send and receive SOAP message over HTTP transport.
  6. XML over HTTP[http binding] means send and receive XML messages over HTTP transport without using SOAP.
  7. The support of XML over HTTP[http binding] enables the deployment and consumption of Web services defined using RESTFUL services.

Dynamic Proxy

The JAX-WS automatically creates proxy object at run time which is an instance of SEI, Hence,we do not need to generate stub classes.

The following diagram show the process of creating SEI interface and proxy instance.


The following steps detailing the process of creating and using SEI and its proxy object:

  1. the wsimport tool is used to generate SEI for corresponding<wsdl:portType>element.
  2. The proxy object(subclass of SEI)is automatically created at run time when getport() method on service interface (javax.xml.ws.Services) is invoked.
  3. The JAXB generated classes becomes parameters and return values of SEI methods.
  4. The proxy object marshalls method parameters as SOAP request.
  5. The proxy object receives SOAP response and unmarshal it into return value.


The wsimport tool does following:

  1. Generates Endpoint interface(SEI) which maps with <wsdl:portType> element.
  2. Generates JAXB classes which maps with <wsdl:types> element.
  3. Syntax: c:/>wsimport -s . -d . RequestOrder.wsdl
  4. The source files are generated to the directory specified by ‘-s’ option.
  5. The compiled classes are generated to the directory specified by ‘-d’ option.
  6. The JAXB annotations are added to generated JAXB java classes.Similarly,the JAX-WS annotations are to generated SEI.
  7. conclusion:The JAX-WS provides standard mapping between wsdl and java types.


    1. JAXB binding framework uses jaxb annotations to determine how to marshal/unmarshal a JAXB java object to/from XML message.
    2. JAX-WS runtime uses jax-ws annotations on SEI to determine how to marshal a method invocation to a SOAP request message and unmarshal a SOAP response into a method’s return value.

    The annotated Services Endpoint interface (SEI) is below:

    import java.jws.*;
    import javax.xml.bind.annotation.*;
    public interface RequestOrderPort{
    public OrderType requestOrder(
    String custNO,
    String purchORDNO,
    BUSOBJCCARD ccard,
    List<BUSOBJITEM>item)throws InputFault;

    the below table describes jax-ws annotations:

    Annotation Description Example
    @WebService Indicates SEI mapped with <wsdl:portType>
    @WebMethod Indicates method mapped with <wsdl:operation>
    @WebResult Indicates method return type mapped with <wsdl:part>
    @RequestWrapper Indicates the request wrapper bean -a JAXB generated class that maps to the request message’s top level element name This annotation is not applicable for rpc/literal
    @ResponceWrapper Indicates the response wrapper bean -a JAXB generated class that maps to the response message’s top level element name This annotation is not applicable for rpc/literal
    @WebParam Indicates SEI method’s parameter maps with <wsdl:part>element