The JavaTM Web Services Tutorial
Home
TOC
Index
PREV TOP NEXT
Divider

Building, Installing, and Running the Application

The source code for the Coffee Break application is located in the directory <JWSDP_HOME>/docs/tutorial/examples/cb. Within the cb directory are subdirectories for each Web application--jaxm, 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.


Note: The Web applications are installed into Tomcat using ant install task. Before you can use the install task you must create a file named build.properties in your home directory that contains the user name and password you provided when you installed the Java WSDP. See Running Manager Commands Using Ant Tasks.

Building the Common Classes

To build the common classes:

  1. In a terminal window, go to <JWSDP_HOME>/docs/tutorial/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 <JWSDP_HOME>/docs/tutorial/examples/cb/jaxrpc.
  2. Run ant build. This task generates the JAX-RPC ties and stubs, creates the JAXR and client libraries, compiles the server classes, and copies them into the correct location for installation.
  3. Start Tomcat and Xindice if they are not already running. This starts the Registry Server.
  4. Run ant set-up-service. This task installs the JAX-RPC service into Tomcat and registers the service with the Registry Server. The registration process can take some time, so wait until you see the following output before proceeding to the next step:
      run-jaxr-publish:
        [echo] Running OrgPublisher.
        [echo] Note: Remember to start the registry server before
        running this program.
        [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
     
    
  5. You can test that the JAX-RPC service has been installed correctly by running one or both of the test programs: execute ant run-test-price or ant run-test-order. Here is what you should see when you run ant run-test-price:
      run-test-price:
      run-test-client:
        [java] 05/21/02 06/20/02
        [java] Kona 6.50
        [java] French Roast 5.00
        [java] Wake Up Call 5.50
        [java] Mocca 4.00
     
    
    Later on, you may remove the JAX-RPC service by running ant take-down-service. This command deletes the service from the Registry Server and then uninstalls the service from Tomcat. Do not remove the service at this time.

Building and Installing the JAXM Service

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

  1. In a terminal window, go to <JWSDP_HOME>/docs/tutorial/examples/cb/jaxm.
  2. Run ant build. This task creates the client library and compiles the server classes and copies them into the correct location for installation.
  3. Make sure Tomcat is started.
  4. Run ant install. This task installs the JAXM service into Tomcat.
  5. You can test that the JAXM service has been installed correctly by running one or both of the test programs: execute ant run-test-price or ant run-test-order.

Building and Installing the Coffee Break Server

To build and install the Coffee Break server:

  1. In a terminal window, go to <JWSDP_HOME>/docs/tutorial/examples/cb/server.
  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 installation. Note that the Coffee Break server depends on the client libraries generated by the JAX-RPC (jaxrpc-client.jar) and JAXM (jaxm-client.jar) build process.
  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 executing ant list in a terminal window or opening http://localhost:8080/manager/list. In a browser, you should see something like:

OK - Listed applications for virtual host localhost
/manager:running:0:../server/webapps/manager
/jaxm-translator:running:0:D:\jwsdp-1_0\webapps\jaxm-
translator.war
/jaxm-coffee-supplier:running:0:D:/jwsdp-1_0/docs/tuto-
rial/examples/cb/jaxm/build
/jaxm-soaprp:running:0:D:\jwsdp-1_0\webapps\jaxm-soaprp.war
/saaj-simple:running:0:D:\jwsdp-1_0\webapps\saaj-simple.war
/jaxm-remote:running:0:D:\jwsdp-1_0\webapps\jaxm-remote.war
/jstl-examples:running:0:D:\jwsdp-1_0\webapps\jstl-
examples.war
/registry-server:running:0:D:\jwsdp-1_0\webapps
egistry-server.war
/jaxmtags:running:0:D:\jwsdp-1_0\webapps\jaxmtags.war
/jaxm-simple:running:0:D:\jwsdp-1_0\webapps\jaxm-simple.war
/jaxrpc-coffee-supplier:running:0:D:/jwsdp-1_0/docs/tuto-
rial/examples/cb/jaxrpc/build
/cbserver:running:1:D:/jwsdp-1_0/docs/tuto-
rial/examples/cb/server/build
/:running:0:D:\jwsdp-1_0\webapps\ROOT
/admin:running:0:../server/webapps/admin
 

The highlighted applications are the Coffee Break server and the JAX-RPC and JAXM services.

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 18-2.

Figure 18-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 18-3.

Figure 18-3 Order Confirmation

Deploying the Coffee Break Application

The instructions in the previous section described how to install and run the Coffee Break application. However, an installed application is not available when Tomcat is restarted. To permanently deploy the application:

  1. Remove the JAXRPC and JAXM services and the Coffee Break server by executing ant remove in each Web application directory.
  2. Package the applications into WAR files by executing ant package in each Web application directory.
  3. Deploy the application by executing ant deploy in each Web application directory.
Divider
Home
TOC
Index
PREV TOP NEXT
Divider

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.