0% found this document useful (0 votes)
20 views8 pages

TP3 SOA HelloWorld

This document provides steps to create a web service using Eclipse and deploy it on a Tomcat server. It describes how to set up Tomcat and Axis2 on Eclipse, create a HelloWorld web service project, generate the service skeleton, and test the service.

Uploaded by

karyym bn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

TP3 SOA HelloWorld

This document provides steps to create a web service using Eclipse and deploy it on a Tomcat server. It describes how to set up Tomcat and Axis2 on Eclipse, create a HelloWorld web service project, generate the service skeleton, and test the service.

Uploaded by

karyym bn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

WS deployment with Eclipse and Tomcat

This tutorial shows you how to create a web service using Eclipse and deploy it on the Tomcat server.

Setting up Tomcat on Eclipse


1. Download and install Tomcat (version 9.0.93) on your machine.
2. Open the server view on Eclipse by the menu Windows→Show View→Other→Servers.
3. Right click on the Server view select New→Server.
Let the Server's host name localhost,
select the Server type Apache→Tomcat v7.0 Server.
Click Next.

4. Specify the installation directory, path to\apache-tomcat-9.0.93.


Click Finish.

TP SOA L3 Info ISIMM Rania Mabrouk


5. You can test the server by clicking on the Start and Stop button at the Server view.
You can also reconfigure the server by selecting Windows→Preferences→Server→Runtime
Environments.

Setting up Axis2 on Eclipse


Apache Axis2 is Web services/SOAP/WSDL engine and is the successor of Apache Axis. It supports both
SOAP 1.1 and 1.2.
1. Download and extract Axis2 1.6.2 binary distribution and extract it on your machine.
2. Download the axis.war file the add it under path to\Tomcat 9.0\webapps
3. Select Window→Preferences on eclipse.
Go to Web services→Axis2 Preferences.
In Axis2 runtime location browse to your axis2 home folder (path to/ axis2-1.6.2).
Click Ok.

TP SOA L3 Info ISIMM Rania Mabrouk


HelloWorld service deployment
1. Create a Dynamic Web project named WS_HelloWorld by selecting File→New→Dynamic Web
Project.
Keep the Target Runtime as Apache Tomcat v7.0.
Select the Dynamic web module version as 2.5.
In the Configuration part, click on modify and check Axis2 Web Services then click Ok.
Click Finish.

TP SOA L3 Info ISIMM Rania Mabrouk


2. Open the WS_HelloWorld project, right click on the Java Resources directory,
select New→Package.
Name it as tps.ws.deployment.
Click Finish.

3. Create a Java class named HelloWorld under the package tps.ws.deployment.

TP SOA L3 Info ISIMM Rania Mabrouk


4. In the HelloWorld class, create the function sayHello which returns the string “Hello Word”.

package tps.ws.deployment;
public class HelloWorld {
public String sayHello()
{ return( "Hello World ") ;} }

5. Right click on the HelloWorld class, select Web Sevices→Create Web service.

6. In the Configuration part, select Web service runtime: Apache Axis


and select Apache Axis2 in the Web service runtime tab,
then click Ok.
Click Finish.

TP SOA L3 Info ISIMM Rania Mabrouk


➔ The WS skeleton is automatically generated, the service is automatically published on the Eclipse's
Tomcat server, and the Tomcat server automatically run.

7. The WSDL file in axis2 is dynamically generated on service deployment.


To access it from eclipse Web service explorer, right click on WS_HelloWorld project,
then Run as→Run on a server.
Choose Tomcat v7.0.
Click Next.

TP SOA L3 Info ISIMM Rania Mabrouk


8. Make sure that WS_HelloWorld project is in the Configured list.
If not add it from Available list to Configured list.
Click Finish.

TP SOA L3 Info ISIMM Rania Mabrouk


9. A Welcome page appears.
10.

11. Select services. A list of available services is presented. Click on HelloWorld service to see the
corresponding WSDL file.

12. To invoke the sayHello operation, enter the following url in eclipse web service explorer
http://localhost:8080/WS_HelloWorld/services/HelloWorld/sayHello.

13. To access your service from your browser, right click on WS_HelloWorld,
then select Export→war file.
Browse to your tomcat Webapps folder and click Finish.
Start your server from your tomcat bin folder.
Then enter the following url http://localhost:8080/WS_HelloWorld/services/HelloWorld?wsdl
to access to the wsdl file.

TP SOA L3 Info ISIMM Rania Mabrouk

You might also like