blob: 614b5dc5fca10df5bacc542dc31538f08e66bd4b [file] [log] [blame]
<!--
/*******************************************************************************
* Copyright (c) 26.04.2007 WSO2 Inc. Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* WSO2 Inc - Initial version of the Tutorial
* 20070426 182718 sandakith@wso2.com Lahiru Sandakith, Initial Tutorial Implementation
* 20070513 186704 sandakith@wso2.com Lahiru Sandakith, Update the BU Tutorial to sync with the Axis2 1.2
*******************************************************************************/
-->
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="./default_style.css" type="text/css">
<link rel="stylesheet" href="stylesheets/wtp.css" type="text/css">
<title>Eclipse WTP Tutorials - Creating Bottom Up Web Service via Apache Axis2</title>
</head>
<body>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<tbody>
<tr>
<td width="60%" align="left"><font class="indextop" size=5><b>Eclipse WTP
Tutorials - Creating Bottom Up Web Service via Apache Axis2</b></font></td>
<td width="40%"><img width="207" hspace="50" height="129"
align="middle" src="images/wtplogosmall.jpg"></td>
<br>
</tr>
</tbody>
</table>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<col width="16">
<col width="*">
<tbody>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
<b><a href="mailto:sandakith@wso2.com">By Lahiru Sandakith</a></b> <br>
<a href="http://www.wso2.org"> WSO2 Inc.</a><br>
May 14, 2007<br>
<br>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#0080c0" align="left" colspan="2"><b><font
face="Arial,Helvetica" color="#ffffff">Introduction</font></b></td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
<p><br />
This tutorial is meant to demonstrate the use of the newly introduced
<b>Axis2</b> Web Services tools in the Web Tools Platform Project using the
<b>WTP 2.0</b> drivers. Also This shows how to create a simple Web service
and Web service client from a JAVA class. The JAVA class in this
scenario converts between the Celsius and Farenheit temperature
scales and its the same class that used in the Axis web services
tutorials.</p>
<br />
</td>
</tr>
<tr>
<td valign="top" bgcolor="#0080c0" align="left" colspan="2"><b><font
face="Arial,Helvetica" color="#ffffff">Set Up</font></b></td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
Before creating the Web service, complete the following prerequisite set ups:
<ol>
<li>Download the Axis2 v1.2 binary distribution from
<a href="http://ws.apache.org/axis2/download.cgi">here</a>.</li>
<p><b>Note :</b> Starting with the WTP 2.0 200705111421 integration driver,
Axis2 version 1.2 is the supported version for the Web Services Scenarios.</p>
<li><a href="http://download.eclipse.org/webtools/downloads/">Install
Latest Eclipse WTP 2.0 integration driver.</a></li>
<li><a
href="http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/InstallTomcat/InstallTomcat.html">
Configure Apache Tomcat inside Eclipse WTP</a></li>.
</ol>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#0080c0" align="left" colspan="2"><b><font
face="Arial,Helvetica" color="#ffffff">Creating a bottom up
JAVA bean Web service and Web service client using Axis2 WTP Tools</font></b></td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
<p>This tutorial need a Axis2 runtime. You can download the Axis2 v1.2 binary distribution from
<a href="http://ws.apache.org/axis2/download.cgi">here</a>.
<br />
<ol>
<li>Download the latest Axis2 runtime from the above link and
extract it.</li>
<br />
<li>Now we point Eclipse WTP to downloaded Axis2 Runtime. Open <b>Window -&gt; Preferences -&gt; Web Services
-&gt; Axis2 Emitter</b> </li><br>
<img border="0" src="images/1.png"><br>
<p>Select the Axis2 Runtime tab and point to the correct Axis2 runtime
location. Alternatively at the Axis2 Preference tab you can set the default
setting that will come up on the Web Services Creation wizards. For the
moment we will accept the default settings. </p>
<li>Click OK. <br>
<br>
</li>
<li>Next we need to create a project with the support of Axis2 features.
Open <b>File -&gt; New -&gt; Other... -&gt; Web -&gt;
Dynamic Web Project</b></li> <br>
<img border="0" src="images/a1.png"><br>
<p>Click next </p>
<li>Select the name Axis2WSTest as the Dynamic web project
name(You can specify any name you prefer), and select the
configured tomcat runtime as the target runtime</li><br>
<img border="0" src="images/a2.png"><br>
<p>Click next </p>
<li>Select the Axis2 Project Facet </li><br>
<img border="0" src="images/a3.png"><br>
<p>Click next </p>
<li>Select the Axis2 Project Facet </li><br>
<img border="0" src="images/a4.png"><br>
<p>Click Finish</p>
<li>This will create a dynamic web project in the workbench</li><br>
<img border="0" height=100% width=100% src="images/b1.png"><br>
<br>
<br>
</li>
<li>Import the <a href="code/Converter.java">wtp/Converter.java</a>
class into Axis2WSTest/src (be sure to preserve the package).</li><br>
<img border="0" height=100% width=100% src="images/b2.png"><br>
<p>Build the Project, if its not auto build.</p>
<li>By selecting Converter.java source the Open File -&gt; New
-&gt; Other... -&gt; Web Services -&gt; Web Service</li><br>
<img border="0" src="images/c1.png"><br>
<p>Click next </p>
<li>Because the Java bean was selected when the Web services wizard was invoked,
the Web services type is defaulted to bottom up Java Web service and
the correct service implementation is being filled in. Click the Web service runtime hyperlink,
select the Axis2 Web service runtime, click OK.</li> <br><br>
<li>Confirm the server and service project selection.
Use the hyperlinks to change the values if necessary.</li> <br><br>
<li>Make sure the scale setting on the service side is set at <b>Start Service</b> and
the client side is set to <b>No client</b>.
The page should look like the following:</li> <br>
<img border="0" src="images/c2.png"><br>
<p>Click next</p>
<li>This page is the service.xml selection page. if you have a
custom services.xml you can include that by browsing for the moment
default will do.</li><br>
<img border="0" src="images/c3.png"><br>
<p>Click next </p>
<li>This page is the start server page. Click on the start
server. This will start the server runtime.</li><br>
<img border="0" src="images/c4.png"><br>
<p>Click next </p>
<li>This page is the web services publication page, accept the
defaults.</li> <br>
<img border="0" src="images/c5.png"><br>
<p>Click Finish.</p>
<br>
<br>
<li>Now we can run the Dynamic Web Project on the server to see
our bottom up created web service running on axis2 server. For that
Select the Axis2WSTest dynamic web project and select Run -&gt; Run
As -&gt; Run on Server </li><br>
<img border="0" src="images/d1.png"><br>
<p>Click Next. </p>
<li>Make sure you have the Axis2WSTest dynamic web project on
the Configured project.</li> <br>
<img border="0" src="images/d2.png"><br>
<p>Click Next. </p>
<li>This page is the web services publication page, accept the
defaults. </li> <br>
<img border="0" src="images/d3.png"><br>
<p>Click Finish. </p>
<li>By doing the above test the Axis2 server webapp will be
automatically deployed on the configured servlet container and will
display the axis2 home page. Note that the servlet container will start up
according to the Server configuration files on your workspace.
</li><br>
<img border="0" height=100% width=100% src="images/d5.png"><br>
<br>
<br>
<li>By selecting services can view the available services. The
newly created converter service will be available there.</li> <br>
<img border="0" height=100% width=100% src="images/e1.png"><br>
<br>
<br>
<li>Now we'll generate the client for the newly created service
by referring the ?wsdl Given by the Axis2 Server. By clicking on the
newly created converter service will be able to get the ?wsdl URL
for that. </li><br>
<img border="0" height=100% width=100% src="images/e2.png"><br>
<br>
<br>
<li>Open File -&gt; New -&gt; Other... -&gt; Web Services -&gt;
Web ServiceClient </li><br>
<img border="0" src="images/f1.png"><br>
<br>
<br>
<li>Paste the url that obtained from the ?wsdl in the service
definition. Click Next </li><br>
<img border="0" src="images/f2.png"><br>
<br>
<br>
<li>Next page is the Client Configuration Page. Accept the
defaults and Click Finish. </li><br>
<img border="0" src="images/f3.png"><br>
<br>
<br>
<li>The Clients stubs will be generated to your Dynamic Web
Project.</li><br>
<img border="0" height=100% width=100% src="images/t1.png"><br>
<br>
<br>
<li>Now we are going to write the client. import the <a
href="code/ConverterClient.java">ConverterClient.java</a> file to
the workspace. Make sure that you import it to the match the package
names.</li><br>
<img border="0" height=100% width=100% src="images/t2.png"><br>
<br>
<br>
<li>Next Compile and Build the Client. Then Run the client. See
the the results.</li><br>
<img border="0" height=100% width=100% src="images/t3.png"><br>
<br>
<br>
</ol>
</p>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#0080c0" align="left" colspan="2"><b><font
face="Arial,Helvetica" color="#ffffff">Summary</font></b></td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
<p>The Web Service wizard is orchestrating the end-to-end
generation, assembly, deployment, installation and execution of the
Web service, Web service client. In this scenario, we completed the
bottom-up web service creation scenario using WTP web services tools.
Most of the time the wizard will pick reasonable defaults according
to the basic high-level choices. After completing this scenario, the
WSDL for the Converter Web service can be found in Clicking on the
available services converter service link Now that your Web service
is running, there are a few interesting things you can do with this
WSDL file. Examples:
<ul>
<li>You can choose Web Services -&gt; Test with Web Services
Explorer to test the service.</li>
<li>You can choose Web Services -&gt; Publish WSDL file to
publish the service to a public UDDI registry.</li>
<li>You choose New -&gt; Other... -&gt; Web Services -&gt; Web
Service Client to generate a Web service client.</li>
</ul>
</p>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#0080c0" align="left" colspan="2"><b><font
face="Arial,Helvetica" color="#ffffff">Resources</font></b></td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td>
<td valign="top">
<p>You can also refer the Axis web services creation wizards.
<ul>
<li><a
href="http://www.eclipse.org/webtools/jst/components/ws/1.0/tutorials/WebServiceExplorer/WebServiceExplorer.html">Using
Web Service Explorer to test a Web service</a></li>
<li><a
href="http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/BottomUpWebService.html">Creating
Bottom Up Web Service via Axis</a></li>
<li><a
href="http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/TopDownWebService/TopDownWebService.html">Creating
Top Down Web Service via Axis</a></li>
<li><a
href="http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/WebServiceClient/WebServiceClient.html">Consuming
Web service using Web Service Client via Axis</a></li>
</ul>
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>