|
By Kathy Chan
April 29, 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 using the M4 driver.
|
|
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.
|
|
|
Set Up |
|
|
|
Before creating the Web service, there are two
prerequisites:
-
Install Apache Tomcat
- Create a Web project
-
Open
File -> New -> Other... -> Web -> J2EE Web
Module
to create a new flexible project and Web module
.
- Click New...
-
Enter
AreaProject
into the
Name
field.
-
Ensure that the
Target server
is set to
Apache Tomcat v5.0
.
- Click Finish. Result:
-
Enter
area
into the
Module Name
field.
. Result:
-
Click
Finish
.
|
Create a top down Java bean Web service |
|
-
Import the file
AreaService.wsdl
into AreaProject/WebContent.
- Select the AreaService.wsdl file.
-
Open File -> New -> Other... -> Web Services -> Web
Service.
-
In the Web service type combo, select
Skeleton Java bean Web Service
.
-
Select
Overwrite files without warning
. Result:
-
Click
Next
. Result:
-
Click
Next
to get to the
Service Deployment Configuration Page
. Result:
-
If you want to choose a server different
from the one defaulted by the wizard, click the
Edit
button to:
select a server
-
Click
Finish.
-
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.
|