Download FAQ History |  | API Search Feedback

> ## Building, Installing, and Running the Application

> The source code for the Coffee Break application is located in the directory `<``INSTALL``>/jwstutorial12/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.

> ### Building the Common Classes

> To build the common classes:

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

> ### Building and Installing the JAX-RPC Service

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

> 1. In a terminal window, go to `<INSTALL>``/jwstutorial12/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 installs (deploys) 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 output like the following before proceeding to the next step:

> `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>``/jwstutorial12/examples/common/build.properties` as described in Building the Examples.

> 5. 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.
> 6. Test that the JAX-RPC service has been installed correctly by running the test programs:

> `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`

> 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 undeploys the service from Tomcat. Do not remove the service at this time.

> ### Building and Installing the SAAJ Service

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

> 1. In a terminal window, go to `<``INSTALL``>/jwstutorial12/examples/cb/saaj`.
> 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`.
> 5. You can test that the SAAJ 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 `<``INSTALL``>/jwstutorial12/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 packaging. Note that the Coffee Break server depends on the client libraries generated by the JAX-RPC (`jaxrpc-client.jar`) and SAAJ (`saaj-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 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.

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

> 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``>/jwstutorial12/examples/cb/server`.
> 2. Run `ant` `remove`.
> 3. Go to `<``INSTALL``>/jwstutorial12/examples/cb/saaj`.
> 4. Run `ant` `remove`.
> 5. Go to `<``INSTALL``>/jwstutorial12/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``>/jwstutorial12/examples/cb/common`.

Download FAQ History |  | API Search Feedback

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.