Deploying a Web service to a server using the command line tools

After you have created an EAR file using a Web services command line tool, you can deploy it to a server to create the code that allows your service to be available to others. You can deploy the EAR file to WebSphere Application Server using either Rational Developer products or the WebSphere Administrative Console. To deploy the EAR file and test the Web service using Rational Developer products, you will first need to import the EAR file, and then create, configure, and start the Web server.

Importing an EAR file

To import an EAR file:

  1. Open a workspace.

  2. Go to File > Import > EAR file, and click Next.

  3. Click Browse to select the command line test directory from which you ran the Web services command line tool. Click Open.

  4. Expand your project directory (specified by -project when you ran the Web services command line tool), and select the EAR file that you created. Click Open.

  5. In the Import EAR wizard, target the EAR to the appropriate server. J2EE 1.4 EARs must be targeted to a WebSphere Application Server v6, while a J2EE 1.3 EAR can be targeted to WebSphere Application Server v5 or v6. Accept the default settings in the next two windows. Hint: Note the name of the Web project created with the EAR file. If you are importing an EAR file containing an EJB bean, also note the name of the EJB project. You will need this information later to test your Web service. From now on, we will refer to these projects as the imported Web project and the imported EJB project.

  6. Click Finish.

You have now imported an EAR file and its corresponding project.

Note:

You can now create and configure the server to deploy the Web service.

Creating and configuring the Web server

A WebSphere v6 server is created automatically when you create a workspace. If you choose to deploy to this server, go to step 4. Alternately you can create a server manually. To create and configure the server to deploy the Web service:

  1. Select File > New > Other. Select Server and Server and Server Configuration from the lists. Click Next.

  2. Type a server name. From the Server Type list, expand WebSphere version 5.1 or WebSphere version 6.0. If you want to deploy your EAR file to a Unit Test server, select Test Environment. If you want to deploy to a remote server, select Server. Click Finish.

  3. Switch to the Server perspective (Window > Open Perspective > Other > Server).

  4. In the Server Configuration pane, open the pop-up menu of the server you just created. Select Add and Remove projects.

  5. From the Available projects list, select the EAR file that you imported. Click Add to add it to the list of configured projects.

  6. Click Finish.

Once you have deployed your Web service to the server, you can test it.

Related Tasks
Creating a Web service with command line tools
Testing a Web service generated by the command line