Axis: Difference between revisions

From Wiki RB4
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Axis2==
==Axis2==
===Installation===
===Installation===
* extract axis2-1.6.1-bin.zip to C:\Uwes\java\axis2-1.6.1
see [[EONISLaptopHPNew#Axis2|here]]
* set AXIS2_HOME to C:\Uwes\java\axis2-1.6.1


===Introduction===
===Introduction===
If something does not work have a look at the examples in the installation directory.
Apache Axis is an implementation of the [[SOAP|SOAP]] ("Simple Object Access Protocol"). Axis2 is a Web Services / SOAP / WSDL engine, the successor to the widely used Apache [[Axis#Axis1|Axis1]] SOAP stack.


===Operation===
===Operation===


There are two ways to create a web services, either starting by with a wsdl or ???. 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).
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====
====Create a web service for an existing POJO and web application====
Line 15: Line 14:
# add axis2 servlet to web.xml
# add axis2 servlet to web.xml
# add folders conf, modules and services to WEB-INF directory
# add folders conf, modules and services to WEB-INF directory
# for each service group add folder to directory services
# for each service group add sub-folder with group name to directory 'services'
# add folder META-INF to service group directory
# add folder META-INF to service group directory
# add service.xml to META-INF folder
# add <code>services.xml</code> to META-INF folder
# build stub by ???
# generate wsdl by java2wsl from java class file
# generate stub and client wsdl2java (see uweheuer_new build.xml, ant target does not work)
# deploy application
# call webservice either by generated client or by ULR e.g. http://localhost/uweheuer/services/BookmarksServices/addCounter4URL?URLId=2 (additional operation parameter by &)


==Axis1==
==Axis1==
Line 36: Line 38:
===Adding a WebService to a WebApp===
===Adding a WebService to a WebApp===
#Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file.
#Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your WAR file.
#Copy all the Axis Servlet declarations and mappings from axis/WEB-INF/web.xml and add them to your own web.xml
#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)
#Below the servlet-mapping url-pattern add service directories and config files (Axis will parse those on application startup)
#Build and deploy your webapp.
#Build and deploy your webapp.
#deploy the webservice e.g. by ant with an axis-admin task (s. project 'uweheuer', build.xml, target deploy_laptop_webservices)
#deploy the webservice e.g. by ant with an axis-admin task (s. project 'uweheuer', build.xml, target deploy_laptop_webservices)


===Sources===
===Resources===
* [http://www.torsten-horn.de/techdocs/java-soap-axis.htm SOAP Web Services mit Axis]
* [http://www.torsten-horn.de/techdocs/java-soap-axis.htm SOAP Web Services mit Axis]

Latest revision as of 14:28, 9 March 2020

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]