Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

Building, Installing, and Running the Application

The source code for the Coffee Break application is located in the directory <INSTALL>/jwstutorial13/examples/cb/. Within the cb directory are subdirectories for each Web application--saaj, jaxrpc, server--and a directory, common, for classes shared by the Web applications. Each subdirectory contains a build.xml and build.properties file. The Web application subdirectories in turn contain a src subdirectory for Java classes and a web subdirectory for Web resources and the Web application deployment descriptor.

Setting the Port

Several files in the Coffee Break depend on the port that you specified when you installed the Java WSDP. The tutorial examples assume that the server runs on the default port, 8080. If you have changed the port, you must update the port number in the following files before building and running the examples:

Building the Common Classes

To build the common classes:

  1. In a terminal window, go to <INSTALL>/jwstutorial13/examples/cb/common.
  2. Run ant build.

Building and Installing the JAX-RPC Service

To build the JAX-RPC service and client library and install the JAX-RPC service:

  1. In a terminal window, go to <INSTALL>/jwstutorial13/examples/cb/jaxrpc/.
  2. Run ant build. This task creates the WAR file of the JAX-RPC service and the JAR file containing the JAXR routines.
  3. Start Tomcat.
  4. Run ant set-up-service. This task registers the service with the Registry Server and installs it into Tomcat. The registration process can take some time, so wait until you see output like the following before proceeding to the next step:
  5. run-jaxr-publish:
    [echo] Running OrgPublisher.
    [java] Created connection to registry
    [java] Got registry service, query manager, and life cycle manager
    [java] Established security credentials
    [java] Organization saved
    [java] Organization key is edeed14d-5eed-eed1-31c2-aa789a472fe0

    If you get an error, make sure you edited the file <INSTALL>/jwstutorial13/examples/common/build.properties as described in Building the Examples.

  6. Run ant build-client. This task creates the JAR file that contains the classes needed by JAX-RPC clients. The build-client task runs wscompile to generate the stubs and JavaBeans components.
  7. Test that the JAX-RPC service has been installed correctly by running the test programs:
  8. ant run-test-order
    ant
    run-test-price

    Here is what you should see when you run ant run-test-price:

    run-test-price:
    run-test-client:
      [java] 07/21/03 08/20/03
      [java] Kona 6.50
      [java] French Roast 5.00
      [java] Wake Up Call 5.50
      [java] Mocca 4.00

Building and Installingthe SAAJ Service

To build the SAAJ service and client library and install the SAAJ service:

  1. In a terminal window, go to <INSTALL>/jwstutorial13/examples/cb/saaj/.
  2. Run ant build. This task creates the client library and compiles the server classes into the correct location for installation.
  3. Make sure Tomcat is started.
  4. Run ant install.
  5. Test that the SAAJ service has been installed correctly by running one or both of the test programs:
  6. ant run-test-price
    ant
    run-test-order

    Here is what you should see when you run ant run-test-price:

    TBD

Building and Installingthe Coffee Break Server

To build and install the Coffee Break server:

  1. In a terminal window, go to <INSTALL>/jwstutorial13/examples/cb/cbserver/.
  2. Run ant build. This task compiles the server classes and copies the classes, JSP pages, client libraries, and tag libraries into the correct location for packaging.
  3. Make sure Tomcat is started.
  4. Run ant install.

Running the Coffee Break Client

After you have installed all the Web applications, check that all the applications are running by opening the URL http://localhost:8080/manager/html in a browser and entering your username and password in the dialog that appears. You will see /cbserver, /jaxrpc-coffee-supplier, and /saaj-coffee-supplier in the list of applications.

Then, to run the Coffee Break client, open the Coffee Break server URL in a Web browser:

http://localhost:8080/cbserver/orderForm 

You should see a page something like the one shown in Figure 25-2.

Coffee Break Order Form

Figure 25-2 Order Form

After you have gone through the application screens, you will get an order confirmation that looks like the one shown in Figure 25-3.

Coffee Break Order Confirmation

Figure 25-3 Order Confirmation

Removing the Coffee Break Application

To remove the Coffee Break application, perform the following steps:

  1. In a terminal window, go to <INSTALL>/jwstutorial13/examples/cb/server/.
  2. Run ant remove.
  3. Go to <INSTALL>/jwstutorial13/examples/cb/saaj/.
  4. Run ant remove.
  5. Go to <INSTALL>/jwstutorial13/examples/cb/jaxrpc/.
  6. Run ant take-down-service.
  7. Stop Tomcat.

If you want to remove the build and dist directories, run ant clean in each directory, including <INSTALL>/jwstutorial13/examples/cb/common/.

Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

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