SOAP Shopping Cart Sample - Deployment without Ant
iPlanetTM Application Server Samples

Updated June 13, 2001

This document describes the steps required to assemble and deploy the SOAPCart application using the iPlanet Application Server Deployment Tool and the SOAP registration tools.  While this approach is more time consuming than using the command line tools, the Deployment Tool is often used when XML deployment descriptors need to be built from scratch, and it's an excellent way of building these descriptors while minimizing human error.  Since the XML descriptors have been provided with the sample application, it's not necessary to use the Deployment Tool to test the SOAP Cart application and the command-line instructions may be used as an alternative.

This document is divided into three sub-sections:


Assembling Components using Deployment Tool

This step is optional.  Since the web application archive (soap-cart.war) and EJB JAR file (soap-cartEjb.jar) have already been assembled as part of the Shopping Cart sample application, you may proceed directly to the deployment instructions.  If you wish to learn how these archives are constructed or if you wish to make changes to the sample application, this document will describe the steps required.

Assembling the SOAP Cart sample components requires three steps:

Compile Java Source Files

To facilitate recompiling and assembling the web application and EJB JAR, the Ant build facility will be used.  For more information about this build facility and its use with the iPlanet Application Server samples, see the Sample Application Build Facility.

To recompile all source files, follow these steps:

1. Change directories to the SOAP Cart sample application:  cd install_dir/ias/ias-samples/soap/cart/src/.  Edit the Ant build file for the sample, build.xml, to ensure the appropriate libraries are used when compiling and deploying the sample.  To do this, ensure the following properties are set correctly at the top of the script:

2. Compile the Java source files
Execute "build compile" under the install_dir/ias/ias-samples/soap/cart/src/ directory

Create soap-cartEjb.jar Module

Now that the source files have been compiled into Java .class files, you are ready to begin assembling the application. Your first step is to create the EJB JAR file using the Deployment Tool.

Insert EJBs and Supporting Classes

1. Before using the Deployment Tool, create directory location where the assembled modules will be saved:
Create the new directory install_dir/ias/ias-samples/soap/cart/assemble/ outside the Deployment Tool. You will assemble the EJB into a JAR file and save it to this directory
2. Launch the Deployment Tool:
UNIX: Execute install_dir/ias/bin/deploytool&

Windows: Programs->iPlanet Application Server 6.0->iAS Deployment Tool

3. Create soap-cartEjb.jar: 4. Insert all class files needed in the soap-cartEjb.jar file:

Modify Deployment Descriptor Settings for the Cart EJB

1. Modify the deployment descriptor for the Cart EJB 2. Set general attributes for the CartEJB deployment descriptor 3. Close and save the CartEjb deployment descriptor.  Close the EJB descriptor by clicking on the X in the upper right hand corner of the descriptor window. Click on Yes when asked to save the changes

Save the ShoppingCart EJB JAR

Select the soap-cartEjb.jar module and then choose Save from the File menu.

Now that we've assembled the EJB JAR module, we're ready to move on to assembling the web application archive (WAR).

Create soap-cart.war Module

Insert Java Classes, JSPs and HTML Files

1. Create soap-cart.war: 2. Insert all Java class files needed in the soap-cart.war file: 3. Add JSPs and HTML files to the soap-cart.war file

Modify the Web Application Deployment Descriptor

1. Modify the deployment descriptor for the SOAP Cart Web Application 2. Set attributes for the soap-cart web applications deployment descriptor 3. Close and save the soap-cart web application deployment descriptor.  Close the descriptor by clicking on the X in the upper right hand corner of the descriptor window. Click on Yes when asked to save the changes

Modify CartClientServlet Deployment Descriptor

1. Modify the deployment descriptor for the CartClientServlet 2. Set an initialization attribute for the CartClientServlet deployment descriptor 3. Close and save the CartClientServlet deployment descriptor.  Close the descriptor by clicking on the X in the upper right hand corner of the descriptor window. Click on Yes when asked to save the changes

Save SOAP Cart Web Application Archive

Select the soap-cart.war module and then select Save from the File menu.

Now that the EJB JAR and Web Application components have been assembled, they can each be deployed to the iPlanet Application Server.


Deploying Components using Deployment Tool

Open the Components in the Deployment Tool

If you've followed the instructions for assembling the soap-cart.war and soap-cartEjb.jar, they should already be open in the Deployment Tool and you can skip to the next sub-section and proceed to deploying the modules.  If you want to deploy the pre-built components that are included with the sample application, the following steps are required:

1. Launch the Deployment Tool:

UNIX: Execute install_dir/ias/bin/deploytool&

Windows: Programs->iPlanet Application Server 6.0->iAS Deployment Tool

2. Open the pre-built soap-cartEjb.jar file.  This can be done either by selecting Browse for more applications from the initial dialog box or by selecting Open from the File menu.  The EJB JAR file can be found in the following location:  install_dir/ias/ias-samples/soap/cart/soap-cartEjb.jar

3. Open the pre-built soap-cart.war file.  To do this, select Open from the File menu.  The web application archive can be found in the following location:  install_dir/ias/ias-samples/soap/cart/soap-cart.war

Deploy the Application Components

1. Select the soap-cartEjb file in the EJB Modules window

2. Select File -> Deploy from the menu bar

3. If you have not already registered a target application server, do so now by clicking on the Register button. Enter the host name, administrative port number (typically 10817) and username/password for the target application server. Otherwise, select a pre-registered target server

4. Click Deploy to start the deployment process.  The file transfer and application registration process will begin. See the Deploy tab for the status of the deployment. The deployment may take several minutes to complete

6. Repeat the deployment process for the soap-cart web application module

Now that all of the components have been registered with the iPlanet Application Server, the only remaining step is to register the SOAP Shopping Cart Service.


Registering the SOAP Shopping Cart service

A soap service can be registered either via a command line tool or via the Apache SOAP web administration tool (to use Ant to automate this registration process, see the Command-Line Assembly and Deployment documentation, step four).  Both the SOAP command-line and web-based registration utilities are described in the sub-sections below.

Before registering the SOAP service, however, the Java class file should be moved so it is in the application server's classpath.  To do this:

1.  Compile the Java source files.  If this has not already been done, refer to the previous section on source file compilation

2.  Copy the service class file to the application server's classpath.  By convention, we'll use the install_dir/ias/APPS/soap-services/ directory, which should have been added to the application server classpath when SOAP was installed and configured

Copy the file:  install_dir/ias/ias-samples/soap/cart/build/classes/samples/soap/cart/soap/CartService.class

To:  install_dir/ias/APPS/soap-services/samples/soap/cart/soap/CartService.class

Command Line Based SOAP Service Registration

Since a deployment descriptor for the Shopping Cart service is already provided, the fastest means of registering the service is to use the command line utilities described in this section.  The registration tool is a Java program that comes with the Apache SOAP distribution. To use it, following these steps:

1. Set the classpath appropriately in the current shell.  The soap.jar and xerces.jar libraries must be on the classpath when the registration utility is executed.  If it hasn't already been set correctly, shell scripts have been provided to correctly set the environment.  These scripts are titled soap_env.bat and soap_env.sh, and they're located in the install_dir/ias/ias-samples/soap/docs/ directory.  Before executing the scripts, verify that the environment variables (IAS_HOME, SOAP_HOME, XERCES_HOME, and SERVICES_HOME) at the top of each script are set correctly

2. Change directories to the SOAP Shopping Cart sample application directory (cd install_dir/ias/ias-samples/soap/cart/src)

3. Execute the Apache SOAP registration utility using the XML deployment descriptor file provided (DeploymentDescriptor.xml).  The utility uses the following format:

java org.apache.soap.server.ServiceManagerClient [url] [operation] [arguments]
To deploy the shopping cart SOAP service, use the following command line:
java org.apache.soap.server.ServiceManagerClient http://localhost/NASApp/soap/rpcrouter deploy DeploymentDescriptor.xml
Web-Based SOAP Service Registration

With the Apache SOAP Administration Tool, it is possible to use a Web browser to deploy and un-deploy services.  It is also possible to review the list and the definitions of the services deployed to a SOAP server. To deploy the shopping cart service, following these steps :

  1. Point your browser to http://<web server host>/NASApp/soap/admin/index.html (for example, http://localhost/NASApp/soap/admin/index.html)  to access the Apache SOAP Administration application
  2. Click on Deploy button in the left pane
  3. A web form will appear where you can fill the information about your soap service
    1. For ID enter urn:ShoppingCart
    2. For Scope of the service enter session
    3. For Method List enter 'getSelectedBooks addBook removeBook removeCart' without any quotes
    4. For Provider type enter java
    5. For Java services, Provider class enter samples.soap.cart.soap.CartService (which is the fully qualified name of the service class)
    6. For Java services, Use static class select no.
    7. You need to define one type mapping. In type mapping section
      1. In the first row, enter SOAP for Encoding Style, urn:xml-soap-shoppingcart-demo for Namespace uri, book for Local Part, samples.soap.cart.Book for Java Type, org.apache.soap.encoding.soapenc.BeanSerializer for Java to XML Serializer, org.apache.soap.encoding.soapenc.BeanSerializer for XML to Java Deserializer.
    8. All other fields in the forms are not required for deploy this service. If you want to get more information about these fields. Please refer to the Apache SOAP documentation
  4. Submit the form.  The service will be deployed and ready to be used by a SOAP client

Running the Sample Applications

Now that components are registered in the iPlanet Application Server and the service has been deployed to the SOAP server, the sample applications may be run.  For instructions on running the sample applications, click here.

Copyright (c) 2001 Sun Microsystems, Inc. All rights reserved.