Deploying the scenario application to the WebSphere Application Server

Now that you have run the iSeries scenario application in the the workbench test environment, you can deploy the application to WebSphere Application Server, as if you were running the application in the real world. Before you deploy the application, however, you need to make a few adjustments, such as securing the administrator's page, and changing a Web service's URL so that the application points to the right place, as explained in the next sections.

Note:
Deploying to WebSphere Application Server is optional; you can still continue to the next chapter and complete the modules without testing the application in WebSphere Application Server.

Configuring WebSphere Application Server

Earlier in the chapter, we discussed Running the application in the workbench. Now that you have deployed the files to the iSeries server, you can run the application on your iSeries using WebSphere Application Server.

To deploy the application to WebSphere Application Server (optional) you need to ensure that:

Note:
For version 5.0 of WAS, the console is browser-based, so you do not need to have a console on your workstation. Consult the on-line documentation to find more information about the various version of WAS.

Your Web-enabled iSeries applications use WebSphere Application Server to run the Java(TM) servlets and JavaServer PagesTM (JSPs) that communicate between the Web user's browser and the iSeries programs or data. To serve your HTML pages and JSP files from the same iSeries system, you also need an HTTP server on that system. We recommend that you use the IBM HTTP Server powered by Apache. You can find documentation about how to use this server in the: IBM HTTP Server for iSeries Documentation Center at http://publib.boulder.ibm.com/pubs/html/iseries_http/v5r1/index.htm.

WebSphere Application Server executes the JavaServer pages, Java beans(TM), and Java servlets that are generated for various processes. The primary documentation resources for IBM WebSphere Application Server for iSeries and IBM WebSphere Administrative Console for iSeries are available at the following Web sites:

Becoming familiar with the IBM WebSphere(R) Application Server documentation, in particular, the sections on J2EE modules, Installing WebSphere Application Server, and Setting up multiple instances of the WebSphere administrative server, is highly recommended. Minimally, you need to carry out the steps under the Installation link.

Use the site map to find information about how to install, configure, and obtain the required PTFs for WebSphere Administrative Console.

Securing the administrator's page

Because the administrator's page, index.html, should only be accessible by authorized people it should be properly secured. This can be done programmatically, in the Web application logic, or by using WebSphere's security feature. In this scenario, we used WebSphere security to secure the page. Note that we used WebSphere Application Server V4.0 Advanced Edition. You can find information about WebSphere Application Server at their Web sites:

If you are using a different version of WebSphere Application Server, refer to that version's documentation on securing Web resources.

You can configure security for Web resources, such as Web pages and servlets, within Development Studio Client, or in the Application Assembly Tool. For this scenario we use Development Studio Client.

To review the security configuration and properties for this Web application:

  1. In Development Studio Client, switch to the Web perspective.
  2. In the Navigator view, expand SV000618 > Web Content > WEB-INF.
  3. Double-click web.xml to open the web.xml view.
  4. Click the Security tab.
  5. To secure index.html, the administration page, a Security constraint has also been defined. At the top of the view, click Security Constraints.
  6. Click the first instance of SecurityContraint in the list.
  7. To the right, click AdminPage.
  8. Click Edit to invoke the Web Resource Collections dialog box. Note that the GET and POST methods for index.html are pre-selected.
  9. Click OK.

In the Security roles section, notice the defined security role named "Administrator." During deployment, individuals are assigned to this role and therefore given access to the index.html page. In the Authorized roles section, note that we have given the role Administrator access to this security constraint. With this security in place, only users assigned to the Administrator role are granted access to the index.html page, after they have provided the proper credentials such as user ID and password. When a resource is secured, WebSphere Application Server first attempts to authenticate the user. Authentication is done using certificates, or by prompting the user for a user ID and password. The prompting can be done with the basic authentication dialog, or by using a custom form.

In this scenario, we designed our own logon page named login.jsp. To configure its authentication prompt, select the Pages tab in the web.xml view. In the Login section, note that Form is pre-selected as the Authentication method. Also note that the name of the Login page is login.jsp. The Error page is displayed when the logon is unsuccessful. In this case, the application re-displays the login.jsp page.

Creating EAR files for iSeries WebSphere Application Server deployment

You need to create EAR files to deploy your application to the iSeries WebSphere Application Server. An EAR file is a standard Java Archive (JAR) file with an .ear extension. They can contain multiple Web project, and you use them to package and deploy your Web applications to the WebSphere Administrative Server (WAS).

To create the EAR files:

  1. Switch to the Web perspective.
  2. In the Navigator view, right-click SVStoreEAR and select Export.
  3. In the Export window, click EAR file and click Next.
  4. Under Where do you want to export the resources to?, click Browse and navigate to a directory on your iSeries Integrated File System where you can keep the EAR files. (You need to have mapped your network drive to an iSeries IFS).
  5. Enter SVRetailStorEAR.ear in the File name field and click Open.
  6. Click Finish.
  7. Repeat steps 2 to 6 for SVWholeSaleEAR.

Deploying the EAR files to iSeries WebSphere Application Server

Now that you have created the EAR files, you can deploy them to WebSphere Application Server.

  1. Open the WebSphere Administrative Console.
  2. Right-click Enterprise Applications and select Install Enterprise Application.
  3. Select the Install Application (*ear) radio button.
  4. Click the upperBrowse button (the lower is unavailable).
  5. Navigate to the IFS directory where you exported the EAR files.
  6. Select SVRetailStorEAR.ear.
  7. Enter "RETAILSTOR" in the Application name field.
  8. Click Next and enter your iSeries server user ID for the administrator's role.
  9. Click Next repeatedly until you are at the page titled Selecting Virtual Hosts for Web Modules.
  10. For all three Web modules, click Select Virtual Host and select your preferred virtual server from the drop-down list. (If you are not sure which one to select, use default or default_host.)
  11. Click Next.
  12. For all three Web modules click Select Server and select the server that you want to use. (If you are not sure which one to select, use Default Server.)
  13. Click Next.
  14. Click Finish and click OK in the dialog box.
  15. Right-click Enterprise Applications again and select Install Enterprise Application.
  16. Click the bottom Browse button (the upper one is unavailable).
  17. Navigate to the IFS directory where you placed the EAR files.
  18. Select SVWholesaleEAR.ear.
  19. Enter "WHOLESALE" in the Application name field.
  20. Click Next repeatedly, until Finish is enabled.
  21. Click Finish and click OK on the dialog box.
    Note:
    It might take a few minutes for a confirmation message to appear.

Running the application in WebSphere Application Server

To take on the role of the customer and run the retail store entry point, enter the following URL into a Web browser:

http://your iSeriesHostName:yourHTTPPortNumber/SV001585/shop.html

To take on the role of the administrator and run the WholeSale entry point, enter the following URL into a Web browser:

http://your iSeriesHostName:yourHTTPPortNumber/SV000618/index.html

If you do not know the HTTP port number, ask your WebSphere Application Server administrator.


[ Top of Page | Previous Page | Next Page | Table of Contents ]