blob: 8ae96fef0ba56b9681c00c302b339164c4d3ef42 [file] [log] [blame]
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link type="text/css" href="../../../../../..//default_style.css" rel="stylesheet">
<link type="text/css" href="../../../../../..//webtools/wtp.css" rel="stylesheet">
<title>Creating Top Down Web Service</title>
</head>
<body>
<table border="0" cellpadding="2" cellspacing="5" width="100%">
<tbody>
<tr>
<td align="left" width="60%"><font class="indextop">Creating Top Down Web Service</font>
<br>
<font class="indexsub">Creating Top Down Web Service</font></td><td width="40%"><img src="../../../../../..//webtools/images/wtplogosmall.jpg" align="middle" height="129" hspace="50" width="207"></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="2" cellspacing="5" width="100%">
<col width="16">
<col width="*">
<tbody>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<p>
<b>By Kathy Chan</b>
<br>
September 19, 2005
<br>
<br>
</p>
</td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#0080c0" valign="top"><b><font color="#ffffff" face="Arial,Helvetica">Introduction</font></b></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<br>
</td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<p>
This document is one of a series of tutorials to
demonstrate the use of the Web Services tools in the Web
Tools Platform Project using the <b>WTP 1.0 M8 drivers</b>.
</p>
</td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<p>
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.
</p>
</td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<br>
</td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#0080c0" valign="top"><b><font color="#ffffff" face="Arial,Helvetica">Set Up</font></b></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<br>
</td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<p>
Before creating the Web service, there are two
prerequisites:
<ol>
<li>
<a href="InstallTomcat.html">
Install Apache Tomcat
</a>
</li>
<li>Create a Web project</li>
<ol>
<li>
Open
<b>
File -&gt; New -&gt; Other... -&gt; Web -&gt; Dynamic Web
Project
</b>
to create a Web module.
</li>
<li>Click <b>Next</b>.</li>
<li>
Enter
<tt>Area</tt>
into the
<b>Name</b>
field.
</li>
<li>
Ensure that the
<b>Target server</b>
is set to
<b>Apache Tomcat v5.0</b>
. If you have not previously configured
a server runtime use the <b>New...</b>
button beside the <b>Target server</b> field to
do so. Result:
</li>
<br>
<img border="0" SRC="resources/Area.JPG">
<br>
<li>
Click
<b>Finish</b>.
</li>
<li>
Say <b>Yes</b> to open the J2EE perspective and you will
see the <tt>Area</tt> project you created listed
under <b>Dynamic Web Projects</b> in the <b>Project Explorer</b>
view. Expand the <tt>Area</tt> project to
see its contents.
</li>
</ol>
</ol>
</p>
</td>
</tr>
<tr>
<td colspan="2" align="left" bgcolor="#0080c0" valign="top"><b><font color="#ffffff" face="Arial,Helvetica">Create a top down Java bean Web service</font></b></td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<ol>
<li>
Import the file
<a href="resources/AreaService.wsdl">AreaService.wsdl</a>
into AreaProject/area/WebContent.
</li>
<li>Select the <b>AreaService.wsdl</b> file.</li>
<li>
Open File -&gt; New -&gt; Other... -&gt; Web Services -&gt; Web
Service.
</li>
<li>Click <b>Next</b>
</li>
<li>
In the Web service type combo, select
<b>Top down Java bean Web Service</b>
.
</li>
<li>
Select
<b>Overwrite files without warning</b>
. Result:
</li>
<br>
<img border="0" SRC="resources/td1.JPG">
<br>
<li>
Click
<b>Next</b>
. Result:
</li>
<br>
<img border="0" src="resources/td2.JPG">
<br>
<li>
Click
<b>Next</b>
to get to the
<b>Service Deployment Configuration Page</b>
. Result:
</li>
<br>
<img border="0" src="resources/td3.JPG">
<br>
<li>
If you want to choose a server different
from the one defaulted by the wizard, click the
<b>Edit</b>
button to:
<a href="SelectServer.html">
select a server
</a>
</li>
<li>
Click
<b>Finish</b>.
</li>
<li>
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
<b>AreaServiceSOAPImpl.java</b>
will appear in the browser view. Fill in the expression
<b>parameters.getHeight()*parameters.getWidth()</b>
as the return value for the <tt>calculateRectArea</tt> method and save the file.
</li>
<br>
<img border="0" SRC="resources/td4.JPG">
</ol>
</td>
</tr>
<tr>
<td align="right" valign="top">&nbsp;</td><td valign="top">
<p>
Follow the instructions at
<a href="WebServiceClient.html">
Creating Web Service Client
</a>
to create a Web service client that you can then use to test this Web service.
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>