Originally from: http://blog.9cbs.net/tenwang1977/Archive/2004/07/06/35550.aspx
I. Introduction to AXIS
1. What is SOAP?
SOAP is an XML-based transmission protocol for communication data encoding between applications. It was initially proposed by Microsoft and Userland Software. With the continuous improvement and improvement, SOAP quickly was widely used in the industry, and the fully released version was 1.1. During its development, W3C XML standard working group actively promotes SOAP to become a real open standard. When writing this document, the SOAP1.2 draft has been released, and 1.2 to the relatively confusing part of 1.1 is improved. SOAP is widely used as a new generation of cross-platform, cross-language distribution calculation of Web Services.
2. What is AXIS?
AXIS is the SOAP engine launched by Apache, and the AXIS project is the successive project of Apache's famous SOAP project. The latest version is currently developed by Java development, C version is being developed. Axis v1.1 package can be downloaded from http://ws.apache.org/axis/dist/1_1/. But AXIS is not just a SOAP engine, but it also includes: a single running SOAP server plugin, this servlet engine can be Tomcat to extend the WSDL's extension to generate a WSDL's description to generate a Java class tool Some sample code There is a tool for monitoring TCP / IP packages, AXIS installation
Application AXIS Development Web Services, you need to install the following software: 1.jdk1.4.22. A server engine that supports servlets, such as a widely known Tomcat.
After the Tomcat is installed, simply add the downloaded AXIS software to compress it, the "Axis" directory under the "WebApps" directory is copied to the "WebApps" directory in the Tomcat installation directory.
Third, AXIS configuration
AXIS is based on Java development, which can be deployed in a variety of operating systems. You need to configure a range of system variables before use, where you have installed Tomcat 4.0 or more, and the system variables you need to configure are as follows:
Catalina_Homec: / Tomcat_4_1
(This should be the installation location of Tomcat, pay attention to the path in the path name)
AXIS_HOME% CATALINA_HOME% / WebApps / Axis
AXIS_LIB% AXIS_HOME% / LIB
AXISCLASSPATH% AXIS_LIB% / AXIS.JAR;% AXIS_LIB% / Commons-Discovery.jar;% AXIS_LIB% / Commons-logging.jar;% AXIS_LIB% / jaxrpc.jar;% AXIS_LIB% / saaj.jar;% AXIS_LIB% / Log4j -1.2.8.jar;% AXIS_LIB% / XML-Apis.jar;% AXIS_LIB% / XERCESIMPL.JAR
Add:% AXIS_LIB% / AXIS.jar;% AXIS_LIB% / Commons-Discovery.jar;% AXIS_LIB% / Commons-logging.jar;% AXIS_LIB% / jaxrpc.jar;% AXIS_LIB% / saaj.jar;% AXIS_LIB % / log4j-1.2.8.jar;% AXIS_LIB% / XML-APIS.jar;% AXIS_LIB% / XERCESIMPL.JAR
Fourth, AXIS test
After the installation is configured, it should be tested whether Axis can run correctly.
Start the Tomcat server, access http: // localhost: 8080 / axis / happyaxis.jsp in the browser, if the page is displayed, you need to look back if the relevant configuration is correct, if the browsing page can correctly display the system components, attributes When the parameter configuration information, the installation is successful. You can now develop your Web Services app. 5. The release of the service AXIS provides two service release methods, one is instant deployment, one is a custom release (Custom deployment).
1. Use instant to release Java Web Service (JWS)
For instant release support is one of the features of AXIS, using instant release enables users to provide the source code for the Java class providing service, you can quickly release it into a web service. Whenever the user calls this type of service, AXIS will automatically compile, even if the server is restarted, it is not necessary to do anything, it is very simple and fast.
Using instant release first requires a Java source file that implements service functions, change its extension to .jws (Java Web Service Abbreviation), then place the file into the "... / WebApps / Axis" directory. Here, a service from the long unit conversion from miles to kilometers, the source code is as follows:
Document DISTANCE.JWS
Public Class Distance {Public Double ConvertMile2kilometre (double Mile) {Return Mile * 1.609; // Implement miles to km from distance conversion}}
Put it in the "... / WebApps / Axis" directory, by accessing http: // localhost: 8080 / axis / distance.jws? WSDL can see the WSDL description file of this service, this shows that the DISTANCE service was successfully released.
The description WDSL code is as follows: XML Version = "1.0" encoding = "UTF-8"?> - "ConvertMile2Kilometre"> 2. Use custom release Web Service Deployment Descriptor (WSDD) Immediately release is an exciting technology that makes the development of web services are so simple; however, it is not always the best choice, such as some application systems are available, we don't buy source code, Only .class files, but we wish to release some of this application system into a web service, enabling it to generate a larger range, and this time I have no power. In addition, instant publishing techniques are not flexible, and more service configurations cannot be made, which makes it unable to meet the needs of some particular systems. Therefore, AXIS provides another service release method, which is custom release. Here, a service from gallon to rising volume unit conversion is given, and its source code is as follows: File Capacity.java package Samples.capacity; public class capacity {public double convertgallon2litre (double gallon) {return gallon * 4.546; // realize gallon to rise volume conversion} // ConvertGallon2litre () } / * Capacity * / compiles it into a .class file, place it into the "... / WebApps / Axis / Samples / Capacity" directory, you can start. Customized release does not need to build .jws file, but must create a service release description file deploy.wsdd (Abbreviation for Web Service Deployment Descriptor), this file is responsible for describing the name, entrance and other information of the service, the content is as follows: File Deploy.wsdd The provider of the service here is "Java: RPC", which is built in Axis and indicates a Java RPC service, and the class for this processing is org.apache.axis.providers.java.rpcProvider. We tell the RPC service to call the class, while another Put this file in the "... / WebApps / Axis / Samples / Capacity" directory, then you can use a client management tool -AdminClient provided by AXIS to complete the custom release of the service. Under the "... / WebApps / Axis / Samples / Capacity" directory, run: Java -cp% AxisclassPath% org.apache.axis.client.adminClient Deploy.wsdd If you don't find a class, you may be that the class path is not configured. It is recommended to write all the JAR related to AXIS to the classpath. This will only be run: Java org.apache.axis.client.adminClient Deploy.WSDD can see the following ruling results: Processing file deploy.wsdd This indicates that the Capacity service custom release is completed. You can also call: java org.apache.axis.client.adminClient undeploy.wsdd to cancel deployment. You can also call: java org.apache.axis.client.adminClient List to get a list of all deployed services. Here you will see Services, Handlers, Transports, etc., pay attention to this call just lists the file content of web-inf / server-config.wsdd. Be sure to note: Compiled Class files To copy to web-inf / class directory, if there is a package in this file, don't forget to create a package in the CLASSES directory through access http: // localhost : 8080 / axis / services / capacity? WSDL can see the WSDL description file for this service, which shows that the Capacity service was successfully released. You can also view all customized published services by visiting http: // localhost: 8080 / axis / servlet / axisservlet. The WDSL is as follows: XML Version = "1.0" encoding = "UTF-8"?> - WSDD Advanced Features: (1) AXIS supports three object ranges: "Request" range: This is the default case, and new objects will be created every SOAP request. "Application" range: A separate shared object will be generated for all requests. "Session" range: Create an object for client requests for each session period. The specified method is as follows: