Setting up Tomcat wi..

searchcoilSoftware and s/w Development

Aug 15, 2012 (4 years and 8 months ago)

268 views

Setting up Tomcat with Axis2


Tomcat:



Download version 6

http://apache.mivzakim.net/tomcat/tomcat
-
6/v6.0.32/bin/apache
-
tomcat
-
6.0.32.zip



Extract to the root dir
ectory (and not program files to avoid security issues)



No default admin user
-

so add admin user

C:
\
apache
-
tomcat
-
6.0.32
\
conf
\
tomcat
-
users.xml

Add the following line:

<user name="admin" password="admin" roles="standard,manager
-
gui,manager"/>

Axis2:



Downlo
ad
AXIS2
WAR file

http://apache.mivzakim.net//axis/axis2/java/core/1.5.4/axis2
-
1.5.4
-
war.zip



Place it under C:
\
apache
-
tomcat
-
6.0.32
\
webapps



Run Tomcat (C:
\
apache
-
tom
cat
-
6.0.32
\
bin
\
startup.bat)



To verify all works well, go to: http://localhost:8080/axis2/



D
efault admin username:
admin
, passwor
d:
axis2

NetBeans
:



Download version 6 Java edition

http://netbeans.org/
downloads/index.html



Install



Setup tomcat server with Axis in NetBeans

http://netbeans.org/kb/docs/websvc/gs
-
axis.html

Define JAVA_HOME and JDK_HOME:

Web Service
:



From WSDL file you can gen
erate two projects: Server
stubs
and Client

stubs




Server:

o

In NetBeans create a new project (regular Java Class Library)

o

Create a new file and choose
Web Services
-
> Axis2 Service from WSDL

o

Choose the WSDL file


o

Set


meaningful class name

o

Click next for th
e rest of t
h
e wizard

o

A new class will be creates that you'll need to implement (and then deploy)

o

Net
B
eans takes all the relevant code, puts it in a zip file and renames it to *.aar

o

The web service server implementation (aar file) will be placed under:
C:
\
a
pache
-
tomcat
-
6.0.32
\
webapps
\
axis2
\
WEB
-
INF
\
services



Client
:

o

In NetBeans create a new project (regular Java Class Library)

o

Create a new file and choose
Web Services
-
> Web Services Client

(this will
actually be implemented
using

Jax
-
WS, not Axis)

Tip: Sugge
sted strategy on h
ow to convert your current application
to work with web service (
client side):

1.

Implement a new communication framework (in a new package) that will wrap the
generated client stubs in a meaningful method names (interface/plain class)

2.

Imple
ment a class that will implement that interface and will handle all the
communication calls to the stubs (this class should have the server URL either in
creation or using a setter)

3.

Implement the game creation/join flow
-

all the relevant methods and flows

for creating
a new game/joining an existing game
-

keep the player ID, last event ID, etc...

4.

Implement the polling mechanism (with a timer)

5.

Implement a console UI that will show events from the server and ask the user for data
if needed (and call the comm
unication framework in order to return results back to the
server)

6.

Integrate the communication framework with your current application
-

create a GUI for
starting/joining a game

7.

Convert your monopoly logic to handle the server events (and dispatch them to
the GUI)