Samples and applications
The WAS samples gallery provides a set of small, generic samples that show how to perform common enterprise application tasks. The samples demonstrate the use of session and entity enterprise beans, JDBC access, connection pooling, Java Mail, message driven beans, and other Web techniques and reusable componentry. These samples are included in the samples gallery:
- Technology samples that bring many smaller samples together in a common application.
- The PlantsBy Websphere application, which is an online e-store for buying plants and flowers.
- The Message Driven Beans application, which demonstrates the use of message driven beans for point-to-point and publish-subscribe messaging
- The Petstore application, from the Java 2 Platform, Enterprise Edition BluePrints (J2EE BluePrints) program, which demonstrates how to use the capabilities of the J2EE 1.3 platform to develop flexible, scalable, cross-platform enterprise applications.
For information on how to install the samples into your application server, see Install samples on a standalone application server or Install samples on a federated application server.
WAS also includes two additional applications:
- DB2 Web Services Sample contains samples for accessing DB2 using the Web Services Object Runtime Framework (WORF). For more information, see DB2 Web Services Samples.
- IBM Telephone Directory provides the ability to search, view, and manage entries in a directory. For more information, see IBM Telephone Directory.
Additional iSeries samples may be available for download from the Websphere Developer's Domain.
Here are the steps to install the samples in the WAS samples gallery that are included with the WAS on your iSeries server. If the application server has been federated into a Network Deployment cell, see Install samples on a federated application server.
Install samples on a standalone application server
Verify that Option 3, the WAS samples, is installed by performing these steps:
- From your iSeries command prompt, enter the following command:
DSPSFWRSC- If you see this entry, the samples gallery is installed:
5733WS5 3 5050 WAS V5.0 Samples
Use the installsamples script to install the samples into a WAS instance. The script is located in the integrated file system in directory /QIBM/ProdData/WebAS5/Base/samples/bin. Follow the steps below to install the samples:
- Start the server and the instance into which you want to install the samples.
- From the OS/400 command line, start a Qshell session:
STRQSH- Invoke the installsamples script:
/QIBM/ProdData/WebAS5/Base/samples/bin/installsamples -instance instanceName -server serverNamewhere instanceName is the name of the instance and serverName is the name of server into which to install the samples. If the -instance parameter is not specified, the default instance is used. For more options on the installsamples script, use the -help option.
Note: Java Message Server (JMS) is not enabled for the default instance. An instance with JMS enabled must be used to install the samples. For information on how to enable JMS, see the Configure the server: Enable your instance to use Java Message Server topic in Administration.
For example, to install the samples into default server in the default instance shipped with the WAS product, you would invoke installsamples like this:
/QIBM/ProdData/WebAS5/Base/samples/bin/installsamples -instance default -server server1
The installsamples script creates the database collections for the samples, installs the sample applications into the specified server, creates the associated resources such as JDBC drivers and Datasources, and updates the required properties files for the samples.
Open a browser to the WAS samples on iSeries main page at the following URL:
http://your.server.name:port/WSsamples/index.jspwhere your.server.name is the hostname of your iSeries server and port is either your internal HTTP port number or your external HTTP port number. 9080 is the default internal HTTP port number. Descriptions of the samples are given on that page.
Install samples on a federated application server
Verify that Option 3, the WAS samples, is installed on both the iSeries containing the Network Deployment instance and the iSeries containing the Base application server (if they are different) by performing these steps on both iSeries:
- From your iSeries command prompt, enter the following command:
DSPSFWRSC- If you see this entry, the samples gallery is installed:
5733WS5 3 5050 WAS V5.0 Samples
Use the installsamplesnd script on the iSeries containing the Network Deployment instance and the finishsamplesnd script on the iSeries containing the application server to install the samples. The scripts are located in the integrated file system in directory /QIBM/ProdData/WebAS5/Base/samples/bin. Follow the steps below to install the samples:
- From the OS/400 command line on the iSeries containing the Network Deployment instance, start a Qshell session:
STRQSH- Invoke the installsamplesnd script:
/QIBM/ProdData/WebAS5/Base/samples/bin/installsamplesnd -instance instanceName -node nodeName -server serverNamewhere instanceName is the name of the Network Deployment instance, nodeName is the name of the node that contains the application server where the samples will be installed, and serverName is the name of application server where the samples will be installed. If the -instance parameter is not specified, the default instance is used. For more options on the installsamplesnd script, use the -help option.
Note: Java Message Server (JMS) is not enabled for the default instance. An instance with JMS enabled must be used to install the samples. For information on how to enable JMS, see the Configure the server: Enable your instance to use Java Message Server topic in Administration.
- Important: after the installsamplesnd script is done, the cell manager server associated with the Network Deployment instance will be running. DO NOT stop this server or the next steps will not work.
- From the OS/400 command line on the iSeries containing the application server instance, start a Qshell session:
STRQSH- Invoke the finishsamplesnd script:
/QIBM/ProdData/WebAS5/Base/samples/bin/finishsamplesnd -instance instanceNamewhere instanceName is the name of the WAS Base instance. If the -instance parameter is not specified, the default instance is used. For more options on the finishsamplesnd script, use the -help option.
Example: Assume WAS Network Deployment installed on an iSeries with the host name ISERIESND and WAS installed on an iSeries with the host name ISERIESBASE. Further assume an instance was created on ISERIESBASE called "myserver" with the default application server name and node name. Lastly, assume the myserver instance has been federated into the Network Deployment cell in the "default" Network Deployment instance on ISERIESND. To install the samples on the "myserver" application server, here are the steps:
- On ISERIESND, invoke installsamplesnd like this:
/QIBM/ProdData/WebAS5/Base/samples/bin/installsamplesnd -instance default -node ISERIESBASE_myserver -server myserver- On ISERIESBASE, invoke finishsamplesnd like this:
/QIBM/ProdData/WebAS5/Base/samples/bin/finishsamplesnd -instance myserver
The installsamplesnd script installs the sample applications into the specified server and creates the associated resources such as JDBC drivers and Datasources. The finishsamplesnd script creates the database collections for the samples and updates the required properties files for the samples.
Open a browser to the WAS samples on iSeries main page at the following URL:
http://your.server.name:port/WSsamples/index.jspwhere your.server.name is the hostname of your iSeries server and port is either your internal HTTP port number or your external HTTP port number. 9080 is the default internal HTTP port number. Descriptions of the samples are given on that page.
The WAS samples gallery is largely self-explanatory; however, here are some helpful points to keep in mind:
By default, the samples specify *LOCAL for the database to connect to and use collections named TECHSAMP50, PLANTSDB50, PETSDB50 and CATALOG50 and several tables within these collections.
The enterprise applications in WAS are organized into EJB modules and Web modules. You can find the sample Java source code, HTML, JavaServer Pages files, servlet classes, and enterprise beans in the following directories on iSeries.
/QIBM/ProdData/WebAS5/Base/samples/src/samplenameFor example, the source code for the PlantsByWebSphere sample is located in this directory:
/QIBM/ProdData/WebAS5/base/samples/src/PlantsByWebSphereThe subdirectory that contains source for a Web Module ends with 'WAR' and that for a corresponding EJB module ends with 'EJB'. All the Java source is in subdirectories according to its package name. For example, if a package name is com.ibm.somepackage, the source is in the com/ibm/somepackage subdirectory.
You may find it helpful to treat the samples gallery as a starting point for to further your understanding of WAS topics, and you may want to change the samples source code for experimentation and testing. The Build-It-Yourself feature allows you to rebuild the samples with your custom changes. It is recommended that you copy the source files from the /QIBM/ProdData/WebAS5/Base/samples/src directory to your own directory before making changes.
Included with WAS is the DB2 Web Services Samples application. It contains samples for accessing DB2 using the Web Services Object Runtime Framework (WORF). These samples demonstrate the ease of developing Web Services that access iSeries DB2 data.
For WAS for iSeries, using the administrative console install the DB2WebServicesSamples.ear from the directory /QIBM/ProdData/WebAS5/Base/samples/lib/DB2WebServicesSamples/DB2WebServicesSamples.ear
Note: Ensure you are at WAS version 5.0.2 or later.After deploying the application, start the application server to start the application so you can work with the DB2 Web Services samples. The application's URL is http://your.server.name:port/services. The application uses either your external or internal HTTP port.
The IBM Telephone Directory business application ships WAS - Express, but the application can also be installed using WAS for iSeries V5. See the following topic in e-business and Web serving for information about configuring and running the IBM Telephone Directory application: