Axis

From Wiki RB4
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Axis2[edit]

Installation[edit]

see here

Introduction[edit]

Apache Axis is an implementation of the SOAP ("Simple Object Access Protocol"). Axis2 is a Web Services / SOAP / WSDL engine, the successor to the widely used Apache Axis1 SOAP stack.

Operation[edit]

There are two ways to create a web services, either starting by with a wsdl or a Pojo. For creating a wsdl from an existing java class there is a tool Java2WSDL. Then there is a tool WSDL2java which generates the skeleton (server side) and stub (client side).

Create a web service for an existing POJO and web application[edit]

  1. add axis2 servlet to web.xml
  2. add folders conf, modules and services to WEB-INF directory
  3. for each service group add sub-folder with group name to directory 'services'
  4. add folder META-INF to service group directory
  5. add services.xml to META-INF folder
  6. generate wsdl by java2wsl from java class file
  7. generate stub and client wsdl2java (see uweheuer_new build.xml, ant target does not work)
  8. deploy application
  9. call webservice either by generated client or by ULR e.g. http://localhost/uweheuer/services/BookmarksServices/addCounter4URL?URLId=2 (additional operation parameter by &)

Axis1[edit]

Basics[edit]

Apache Axis is an Open Source SOAP server and client. But Axis isn't just a SOAP engine -- it also includes:

  • a simple stand-alone server,
  • a server which plugs into servlet engines such as Tomcat,
  • extensive support for the Web Service Description Language (WSDL),
  • emitter tooling that generates Java classes from WSDL.
  • some sample programs, and
  • a tool for monitoring TCP/IP packets.

Axis handles the magic of converting Java objects to SOAP data when it sends it over the wire or receives results. SOAP Faults are sent by the server when something goes wrong; Axis converts these to Java exceptions. Axis is written as a J2EE 1.2 compliant web application, and can be installed on any J2EE compliant servlet (Tomcat 3.2+, Websphere 4+, Weblogic 6+).

Adding a WebService to a WebApp[edit]

  1. Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file.
  2. Copy all the Axis Servlet declarations and mappings from axis/WEB-INF/web.xml e.g. servlet-name, servlet-class, servlet-mapping, ... and add them to your own web.xml (see uweheuer as an example)
  3. Below the servlet-mapping url-pattern add service directories and config files (Axis will parse those on application startup)
  4. Build and deploy your webapp.
  5. deploy the webservice e.g. by ant with an axis-admin task (s. project 'uweheuer', build.xml, target deploy_laptop_webservices)

Resources[edit]