Top Down Web Service Tutorial
Top Down Web Service Tutorial
 

By Kathy Chan
Feb 25, 2005

Introduction
 
 

This document is a one of a series of tutorials to demonstrate the use of the Web Services tools in the Web Tools Platform Project.

 

This tutorial shows how to create a simple top-down Web service from a WSDL file. The WSDL file in this scenario calculates the area of an rectangle.

 
Getting Started
 
 

Follow the instruction at Getting Started with Web Service before proceeding with the tutorial.

 
Set Up
 
 

Before creating the Web service, there are two prerequisites:

  1. Install Apache Tomcat
  2. Create a Web project
    1. Open File -> New -> Other... -> Web -> J2EE Web Project to create a new Web project named AreaProject .
    2. Enter AreaProject into the Name field.
    3. Choose a Servlet version of 2.3 .
    4. Choose a Target server of Apache Tomcat v4.1 .
    5. Deselect Add module to an EAR project . Result:

    6. Click Finish .

Create a top down Java bean Web service
 
  1. Import the file AreaService.wsdl into AreaProject/WebContent.
  2. Select the AreaService.wsdl file.
  3. Open File -> New -> Other... -> Web Services -> Web Service.
  4. In the Web service type combo, select Skeleton Java bean Web Service .
  5. Select Overwrite files without warning . Result:

  6. Click Next . Result:

  7. Click Next to get to the Service Deployment Configuration Page . Result:

  8. If you want to choose a server different from the one defaulted by the wizard, click the Edit button to: select a server
  9. Click Finish.
  10. It will take about one minute for the wizard to assemble the Web service projects, start Apache Tomcat and deploy the projects to Tomcat. Once finished, the Java implementation file AreaServiceSOAPImpl.java will appear in the browser view. Fill in parameters.getHeight()*parameters.getWidth() as the return value and save the file.

 

Follow the instruction at Creating Web Service Client to create a Web service client to test this Web service.