Skip to main content

Easier Web Service client development with JAX-WS

Posted by kohlert on January 31, 2006 at 11:04 AM PST

JAX-WS has simplified the development of Web Service clients when compared to JAX-RPC. Both technologies
have a tool for importing a WSDL to generate client
side artifacts. JAX-RPC's tool is wscompile, JAX-WS' tool is wsimport.

To use wscompile a config.xml file must be created to
pass to wscompile. A simple config.xml file would look something like:

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="">
  <wsdl  location="http://localhost:8080/helloservice?wsdl"
    packageName="helloservice" />

This config.xml would import the WSDL located at http://localhost:8080/helloservice?wsdl"
and place the generated artifacts in the helloservice package.

You would then run wscompile with the following command-line:

wscompile -gen:client config.xml

To do the same thing with JAX-WS' wsimport
the command-line would be:

wsimport -p helloservice http://localhost:8080/helloservice?wsdl

So with wsimport there is no need for the config.xml file.

The biggest advantage of JAX-WS clients over JAX-RPC clients is portability. JAX-WS generates 100% portable artifacts, while JAX-RPC generated artifacts are not all portable. Also, since JAX-WS is now included in Java SE 6 (Mustang), client applications are much smaller.

For a more complete instructions on how to use JAX-WS check out Bobby's articles on Building Web JAX-WS 2.0 Services with NetBeans and Building JAX-WS 2.0 Services with NetBeans and Glassfish.

You can get more information about JAX-WS on the JAX-WS project on

JAX-WS is part of the Glassfish Community.

Related Topics >>