|
Home
TOC Index |
|
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 thecbdirectory are subdirectories for each Web application--jaxm,jaxrpc,server--and a directory,common, for classes shared by the Web applications. Each subdirectory contains abuild.xmlandbuild.propertiesfile. The Web application subdirectories in turn contain asrcsubdirectory for Java classes and awebsubdirectory for Web resources and the Web application deployment descriptor.
Note: The Web applications are installed into Tomcat usingant installtask. Before you can use theinstalltask you must create a file namedbuild.propertiesin 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
Building and Installing the JAX-RPC Service
To build the JAX-RPC service and client library and install the JAX-RPC service:
- In a terminal window, go to
<JWSDP_HOME>/docs/tutorial/examples/cb/jaxrpc.- 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.- Start Tomcat and Xindice if they are not already running. This starts the Registry Server.
- 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- You can test that the JAX-RPC service has been installed correctly by running one or both of the test programs: execute
antrun-test-priceorantrun-test-order. Here is what you should see when you runantrun-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
anttake-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:
- In a terminal window, go to
<JWSDP_HOME>/docs/tutorial/examples/cb/jaxm.- Run
ant build. This task creates the client library and compiles the server classes and copies them into the correct location for installation.- Make sure Tomcat is started.
- Run ant
install. This task installs the JAXM service into Tomcat.- You can test that the JAXM service has been installed correctly by running one or both of the test programs: execute
antrun-test-priceorantrun-test-order.Building and Installing the Coffee Break Server
To build and install the Coffee Break server:
- In a terminal window, go to
<JWSDP_HOME>/docs/tutorial/examples/cb/server.- Run
antbuild. 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.- Make sure Tomcat is started.
- Run
antinstall.Running the Coffee Break Client
After you have installed all the Web applications, check that all the applications are running by executing
antlistin a terminal window or openinghttp://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/adminThe 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/orderFormYou should see a page something like the one shown in Figure 18-2.
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:
- Remove the JAXRPC and JAXM services and the Coffee Break server by executing
antremovein each Web application directory.- Package the applications into WAR files by executing
antpackagein each Web application directory.- Deploy the application by executing
antdeployin each Web application directory.
|
Home
TOC Index |
|
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.