The JavaTM Web Services Tutorial

Running the Samples

The Java WSDP includes several JAXM sample applications. It also includes various implementations that make it possible for you to run the sample applications. These implementations, which constitute the JAXM reference implementation, are the following:

All of the sample applications use the JAXM API, of course, and some use other implementations as well. For example, the sample application Remote uses the implementations of the messaging provider and the ebXML profile; the SOAP-RP sample uses the implementations for the messaging provider and the SOAP-RP profile. The next section, (The Sample Programs), gives more information about the sample applications and what they do.

Most of the samples run in a container, so before running them, you need to start Tomcat (see Starting Tomcat).

Once Tomcat is running, you can run the JAXM samples by following these steps:

  1. Open a browser window and set it to
  2. On the page that comes up, click on one of the sample programs listed. Then follow the instructions in the new window that comes up.

The Sample Programs

The sample programs illustrate various kinds of applications you can write with the JAXM API. Note that the Simple, Translator, and SAAJ Simple examples log messages sent and received to the directory in your Java WSDP installation where you started Tomcat. So if, for example, you start Tomcat from the <JWSDP_HOME>/bin directory, that is where the messages will be logged. These messages are the XML that is sent over the wire, which you might find easier to understand after you have gone through the tutorial.

There are two other sample programs, jaxm-uddiping and jaxm-standalone, that do not run in Tomcat. To run them, go to the <JWSDP_HOME>/samples/jaxm directory, where you will find the directories uddiping and standalone. Each directory contains a README file that explains what to do.

In the Examples section of the JAXM tutorial ( and, you will find an application that modifies the code in and also explains in detail how to run it. You might find it more convenient to wait until you have reached that section before trying to run the jaxm-uddiping and jaxm-standalone samples.

The preceding list presented the sample applications according to what they do. You can also look at the sample applications as examples of the three possible types of JAXM client:

Source Code for the Samples

Source code for the sample applications is in the directory


You will find six directories, one for each of the samples that runs in Tomcat. The jaxmtags directory contain a number of .jsp files. The other directories all have two files, and In addition to those two files, the translator directory contains the file

If you want to see all of the files that make up a Web web application, you can go to the directory <JWSDP_HOME>/webapps and unpack the .war files. For example, for the Simple sample, you would do the following:

cd <JWSDP_HOME>/webapps
jar -xvf jaxm-simple.war

In addition to the source files and class files for the Simple sample, you will find the files web.xml and build.xml. .

The web.xml file, referred to as a deployment descriptor, associates the endpoint passed to the method or ProviderConnection.send with a particular servlet class. When the container encounters an endpoint, which is generally a URI, it uses the web.xml file to determine the appropriate servlet class and runs it. See the end of the section Sending the Request for an example and explanation.

The build.xml file is the Ant file to use to run the application.


This tutorial contains information on the 1.0 version of the Java Web Services Developer Pack.

All of the material in The Java Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.