Howto: Usage of AXIS in JOnAS
This guide describes basic Axis use within JOnAS. It assumes that the reader
does not require any explanation about Axis-specific tasks (e.g., axis
deployment with WSDD). Before deployment in Axis, the user must verify
that the deploy.wsdd file matches the site 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 (Session Bean) is
packaged in a separate ejb-jar (or even EAR). The intent of this approach
is to make EJBs from differents packages that are already deployed
accessible as Web Services via a single Axis Webapp deployment. The
drawback is that Web Services are centralized in one Webapp only
and the only way to distinguish between them for access is by the
<service-name>, not by the
<context-root>/<service-name>. In addition, the ejb-jar files that contain the Web
Services must be included in the Webapp.
- The accessed EJB(s) are packaged with the Axis Webapp in an EAR
archive. With this approach, the ejb-jar files do not have to be
included in the Webapp WEB-INF/lib directory; different Applications
that contain Web Services can be hosted, providing the capability of
distinguishing between Web Services of different applications.
Libraries
JOnAS incorporates all the 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 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).
- Example: jclient org.apache.axis.client.AdminClient
-hjonasServerHostname -p8080 deploy.wsdd
Example: Refer to the separate_axis example (in the
$JONAS_ROOT/examples directory).
2. Embedded Axis Webapp
Constraints:
- The EJBs exposed as Web Services can have either local or remote
interfaces.
- The EAR must contain a Webapp including a web.xml with Axis servlet
mapping.
Usage:
- Deploy the application archive (EAR) :
- Use the AdminClient tool to deploy the webservices (with a .wsdd
file)
- Example: jclient org.apache.axis.client.AdminClient
-lhttp://localhost:8080/hello/servlet/AxisServlet deploy.wsdd
- Be careful to use a good URL to reach the AxisServlet.
Example: Refer to the embedded_axis example (in the
$JONAS_ROOT/examples directory).
3. Tests
When everything is deployed and running, use the following URL to view the
deployed Web Services:
http://<yourserver>:<port>/<yourwebapp>/servlet/AxisServlet
This page will display a link for each Web Service with the 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>
A client class can now be run against the Web Service. Note that any language
(with Web Services capabilities) can be used for the client (C#, Java, etc.).
Tools:
Use jclient to deploy your Web Services (in the Axis way):
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)