How to use AXIS in JOnAS
The aim of this document is to show basics for Axis usage within JOnAS.
It assumes that the reader does not need explanation about Axis particular
tasks (axis deployment with WSDD, ...). Before deployment in Axis, the
reader has to check the deploy.wsdd file in order to ensure that the file
matches her machine configuration (jndiURL parameter in particular :<parameter name="jndiURL" value="rmi://localhost:1099"/>).
This document describes two ways to make an EJB (stateless SB) available
as a Web Service with JOnAS:
-
Axis runs in a unique Webapp, the stateless SB is packaged in a
separate ejb-jar (or even EAR). The interest of this approach is to make
EJBs from differents packages already deployed accessible as Web
Services by using a single Axis Webapp deployed hereafter. The drawback is
that Web Services are centralized in one Webapp only and then when
you want to access theses Web Services, you can distinct them only on the
<service-name>, not on the couple <context-root>/<service-name>,
and you must include in the Webapp the ejb-jar files which are containing
Web Services.
-
The accessed EJB(s) are packaged with the Axis Webapp in an EAR archive.
With this approach, you do not have to include the ejb-jar files
in the Webapp WEB-INF/lib directory, you can host different Applications
which are containing Web Services, and distinction between Web Services
of different applications can be done.
Libraries
JOnAS incorporates all necessary libraries including :
-
JAX-R : Reference Implementation from Sun
-
JAX-M : Reference Implementation from Sun
-
JAX-P : Xerces XML parser (version 2.4.0)
-
AXIS : Soap implementation from Apache (with all dependent libs
: jaxrpc.jar, ...)
(JAX-M and JAX-R are parts of the Web Services Development
Pack from Sun)
1. Unique Axis Webapp
Constraints :
-
the EJBs exposed as WebServices must have remote interfaces.
-
the Axis Webapp must have in its WEB-INF/lib directory all the ejb-jar
files containing Beans exposed as Web Services.
Usage :
-
deploy the ejb-jars or your EARs containing Web Services.
-
deploy the Axis Webapp (containing the ejb-jar files !)
-
use the AdminClient tool to deploy the Web Services (with a .wsdd
file)
-
ex : jclient org.apache.axis.client.AdminClient -hjonasServerHostname
-p8080 deploy.wsdd
Example : see the separate_axis example (in the $JONAS_ROOT/examples
directory).
2. Embedded Axis Webapp
Constraints :
-
the EJBs exposed as Web Services can either have local or remote interfaces.
-
the EAR must contain a Webapp including a web.xml with Axis servlet
mapping.
Usage :
-
deploy your application archive (EAR) :
-
use the AdminClient tool to deploy the webservices (with a .wsdd
file)
-
ex : jclient org.apache.axis.client.AdminClient -lhttp://localhost:8080/hello/servlet/AxisServlet
deploy.wsdd
-
be carefull to use a good URL to reach the AxisServlet !
Example : see the embedded_axis example (in the $JONAS_ROOT/examples
directory).
3. Tests
Now all the stuff is deployed and running.
You can view the deployed Web Services at this URL :
http://<yourserver>:<port>/<yourwebapp>/servlet/AxisServlet
In this page, you'll see for each Web Service, a link with his WSDL file
(automatically generated by Axis from the Java Interfaces).
Use the following URL to access your Web Service (add ?WSDL for the associated WSDL file)
http://<yourserver>:<port>/<yourwebapp>/services/<Service-Name>
If you have a client class to run against the Web Service, it's time to use it! You should
know that any language (with Web Services capabilities) can be used for your client (C#, Java, ...).
Tools :
In order to deploy your Web Services (in the Axis way) you must use jclient
:
jclient org.apache.axis.client.AdminClient [OPTIONS] <WSDD-file>
[OPTIONS] :
-l<URL> : the location of the AxisServlet
servlet (default : http://localhost:8080/axis/servlet/AxisServlet)
-p<port>: the port of the listening http daemon
(default : 8080)
-h<host>: the hostname of the server
running the JOnAS server (default : localhost)