< Previous | Next >

Lesson 2.1: Install and deploy the Web service

In this exercise, you will install a sample enterprise application (EAR) file onto WebSphere Application Server v6.1 and deploy the EmployeeDirectory Web service. Your application will use this Web service to create, read, update, and delete employee records.

Before you begin, you must complete one of the following options to make sure that your MyDirectory project is at the proper starting point:
Your MyDirectory Java project includes an EmployeeDirectory.ear file. You will use the WebSphere Administrative Console to install the EmployeeDirectory enterprise application that is contained in the EAR file. When you install the application, you also deploy the Web service included in the application. The finished My Company Directory application uses this deployed Web service.

To install the sample EmployeeDirectory application and deploy the Web service on your WebSphere Application Server v6.1 environment:

  1. Start an instance of your application server from the workbench. There are several different ways that you can launch your server, but these steps describe how to do it from the workbench:
    1. Open the Servers view. To add the Servers view to the Java perspective, click Window > Show view > Other and select Server > Servers.
    2. Tthe Servers view lists the servers that are installed and set up.
    3. Right-click your server and select Start. When the Servers view shows the status of the server as Started or the console says Server server1 open for e-business, the server is successfully started. You can now run the Administrative Console.
    Note: If there is no server instance in the Servers view, create a new server:
    1. Right-click in the Servers view and select New > Server.
    2. Use the New Server wizard to add WebSphere Application Server v6.1.
  2. Run the WebSphere Administrative Console. Again, there are other ways to run the Administrative Console, but these instructions describe how to do it from the workbench:
    1. In the Servers view, right-click the server that you just started, and select Run administrative console. The WebSphere Administrative Console opens in a browser window.
    2. Enter a user ID and click Log in. The Welcome page of the Administrative Console opens. The user ID that you enter is only used to track user-specific changes to the configuration data of the server.
  3. Use the Administrative Console to install the EmployeeDirectory.ear enterprise application that is found in your MyDirectory project. The Administrative Console uses a wizard approach to help you install applications, where you click Next to move from page to page until all options are set. To install the sample enterprise application that contains the Web service for this tutorial:
    1. On the left side of the Adminstrative Console, expand the Applications menu option, and click Install New Application.
    2. Select Local file system and in the Specify path field enter the full path to the EmployeeDirectory.ear file that is in your MyDirectory project. Tip: To get the full path, right-click on the EmployeeDirectory.ear file in the Package Explorer and select Properties. The Properties page lists the location of the file, which you can copy and paste into the Specify path field.
    3. Click Next until you reach the Select installation options page.
    4. Select Deploy Web services.
    5. Click Next until you reach the Summary page, then click Finish.
    6. Click the Save to Master Configuration link when you are prompted to apply the changes that you have made to your local configuration. Review the changes and click the Save button.
  4. Use the Administrative Console to start the EmployeeDirectory application:
    1. Click Applications > Enterprise Applications. The EmployeeDirectory application is listed as an installed application on the server, but its status is Stopped.

      Enterprise Applications in Administrative Console

    2. Select the check box next to EmployeeDirectory and click Start. A message indicates that the EmployeeDirectory application started successfully, and the Status icon changes to the green arrow.

The EmployeeDirectory application is now running on localhost at port 9080, and the Web service can now be accessed. After you complete this tutorial, you can go back to the Administrative Console, stop the EmployeeDirectory application, then uninstall it.

If you open the EmployeeDirectory.wsdl file found in your MyDirectory project (it should open in the graphical WSDL Editor by default), you can examine the Web service that you just deployed. If the WSDL file does not open in the WSDL Editor, the Web Service Developer capability might not be turned on in the workbench. You can specify workbench capabilities in the Preferences (Window > Preferences > Workbench > Capabilities).

The following image from the WSDL editor shows the operations available in the EmployeeDirectory service:

Screen shot of Port Types section of WSDL editor

You can use the WSDL editor to examine each operation and its corresponding request messages and return messages. This can help you understand the Web service and how it is used in the remaining exercises.

< Previous | Next >