Lesson 2: Set up JAX-WS on the web client

In this lesson, you set up JAX-WS on the web client to gather database information from the web server. It assumes that you have already set up the Java SE 6 JDK in the C:\Program Files\Java\JDK1.6.0 directory. Note that, at the time of writing, recent versions of the JDK include JAX-WS 2.1.6. To determine if JAX-WS is present, check for a wsimport command in the C:\Program Files\Java\JDK1.6.0\bin directory. If you wish to install a more recent version such as JAX-WS 2.2, then use the following procedure.

 To set up the latest version of JAX-WS on a web client
  1. Download the latest version of JAX-WS. Go to [external link] https://jax-ws.dev.java.net/ to download the latest version.

  2. Install JAX-WS.

    Follow the online instructions to install JAX-WS. This tutorial assumes that all files are extracted to the C:\Program Files\Java directory.

  3. Add the C:\Program Files\Java\jaxws-ri\bin and C:\Program Files\Java\JDK1.6.0\bin directories to your PATH environment variable in the order listed.

    The code used in this tutorial relies on the JDK and JAX-WS binaries. You can write and compile the code from any directory by adding paths to these locations to your PATH environment variable.

  4. Set your CLASSPATH environment variable using the following command:

    SET classpath=.;C:\Program Files\Java\jaxws-ri\lib\jaxb-api.jar;
    C:\Program Files\Java\jaxws-ri\lib\jaxws-rt.jar
  5. Set the JAXWS_HOME environment variable using the following command:

    SET JAXWS_HOME=C:\Program Files\Java\jaxws-ri
  6. Override endorsed standards provided by the Java Runtime Environment (JRE). To override the standard run-time environment, create an endorsed directory under the Java Runtime Environment (JRE) lib directory. This is usually C:\Program Files\Java\JDK1.6.0\jre\lib. Do not place the endorsed directory under the JDK lib directory.

    Copy the jaxws-ri\lib\jaxws-api.jar and jaxws-ri\lib\jaxb-api.jar files to the C:\Program Files\Java\JDK1.6.0\jre\lib\endorsed directory.

    Note

    JAX-WS 2.2 provides additional functionality to packaged objects that are not provided in current versions of the JDK. You must override the endorsed standards to make use of this functionality and prevent runtime errors. For more information about the Java Endorsed Standards Override Mechanism, see [external link] java.sun.com/javase/6/docs/technotes/guides/standards/index.html.