1. soap is an XML-based transmission protocol for data encoding between applications. Initially proposed by Microsoft and userland software, with the continuous improvement and improvement, soap is soon widely used in the industry. At present, the fully released version is 1.1. During its development, the W3C XML standards Team actively promoted soap to become a true open standard. At the time of writing this document, draft soap1.2 has been published, and 1.2 has improved the relatively confusing section in section 1.1. Soap is widely used as an important part of the next-generation cross-platform and cross-language distributed computing Web Services. 2. What is Axis Axis is a SOAP engine launched by Apache. The axis Project is a successor to the well-known soap project of Apache. Currently, the latest version is 1.1, which is developed using Java, the C ++ version is under development. Axis V1.1 software package can beHttp://ws.apache.org/axis/dist/1_1/Download. However, axis is not only a SOAP engine, but also includes: An independent SOAP server A Servlet Engine plug-in, which can be Tomcat Support for WSDL Extension A tool that generates the description of WSDL into a Java class Sample Code There is also a tool for monitoring TCP/IP packets Ii. Installation of Axis To use axis to develop Web Services, you must install the following software: 1. jdk1.4.2 2. A server engine that supports servlet, such as Tomcat, which is widely known. After Tomcat is installed, extract the downloaded axis package, copy the "axis" directory under the "webapps" directory to the "webapps" directory under the tomcat installation directory. Iii. Axis Configuration Axis is developed based on Java and can be deployed in a variety of operating systems. You need to configure a series of system variables before using it. Assume that you have installed Tomcat 4.0 or later on the local machine, the following table lists the system variables to be configured: Catalina_home C:/tomcat_4_1 (This should be the installation location of Tomcat. Note that no space exists 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 the following to classpath: % 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 4. Axis Testing After the installation and configuration are complete, test whether axis can run correctly. Start the Tomcat server and accessHTTP: /localhost: 8080/axis/happyaxis. jspIf an error is displayed on the page, check whether the related configuration is correct. If the system component, attribute, and other parameter configuration information are correctly displayed on the page, the installation is successful. Now you can start developing your Web Services application. 5. Service Release Axis provides two service publishing methods: instant deployment and custom deployment ). 1. Use instant release Java Web Service (JWS) Real-time release support is one of the characteristics of Axis. Using Real-time release allows users to quickly publish a Web Service by providing the source code of the Java class that provides services. Whenever a user calls such a service, axis automatically compiles the service. Even if the server is restarted, it does not have to be processed. To use instant release, you first need a Java source file that implements service functions, change its extension to. JWS (abbreviation of Java Web service), and then place the file in "... /Webapps/axis directory. Here we provide a service that converts the length units from miles to kilometers. The source code is as follows: File distance. JWS Public class distance { Public double convertmile2kilometre (double mile) { Return mile * 1.609; // converts the distance from a mile to a kilometer. } } Put it in "... /Webapps/axisHttp: // localhost: 8080/axis/distance. JWS? WSDLThe WSDL description file of the service is displayed, indicating that the distance service has been released successfully. The wdsl code described is as follows: <? XML version = "1.0" encoding = "UTF-8"?> -<WSDL: Definitions targetnamespace ="Http: // 192.168.0.26: 8080/axis/distance. JWS"Xmlns ="Http://schemas.xmlsoap.org/wsdl/" Xmlns: apachesoap ="Http://xml.apache.org/xml-soap"Xmlns: impl ="Http: // 192.168.0.26: 8080/axis/distance. JWS"Xmlns: INTF ="Http: // 192.168.0.26: 8080/axis/distance. JWS"Xmlns: soapenc ="Http://schemas.xmlsoap.org/soap/encoding/"Xmlns: WSDL ="Http://schemas.xmlsoap.org/wsdl/"Xmlns: wsdlsoap ="Http://schemas.xmlsoap.org/wsdl/soap/"Xmlns: XSD ="Http://www.w3.org/2001/XMLSchema"> -<WSDL: Message name = "convertmile2kilometrerequest"> <WSDL: part name = "Mile" type = "XSD: Double"/> </WSDL: Message> -<WSDL: Message name = "convertmile2kilometreresponse"> <WSDL: part name = "convertmile2kilometrereturn" type = "XSD: Double"/> </WSDL: Message> -<WSDL: porttype name = "distance"> -<WSDL: Operation name = "convertmile2kilometre" parameterorder = "Mile"> <WSDL: input message = "impl: convertmile2kilometrerequest" name = "convertmile2kilometrerequest"/> <WSDL: Output Message = "impl: convertmile2kilometreresponse" name = "convertmile2kilometreresponse"/> </WSDL: Operation> </WSDL: porttype> -<WSDL: Binding name = "distancesoapbinding" type = "impl: distance"> <Wsdlsoap: Binding style = "RPC" Transport ="Http://schemas.xmlsoap.org/soap/http"/> -<WSDL: Operation name = "convertmile2kilometre"> <Wsdlsoap: Operation soapaction = ""/> -<WSDL: input name = "convertmile2kilometrerequest"> <Wsdlsoap: Body encodingstyle ="Http://schemas.xmlsoap.org/soap/encoding/"Namespace ="Http: // defaultnamespace"Use =" encoded "/> </WSDL: input> -<WSDL: Output name = "convertmile2kilometreresponse"> <Wsdlsoap: Body encodingstyle ="Http://schemas.xmlsoap.org/soap/encoding/"Namespace ="Http: // 192.168.0.26: 8080/axis/distance. JWS"Use =" encoded "/> </WSDL: output> </WSDL: Operation> </WSDL: Binding> -<WSDL: Service name = "distanceservice"> -<WSDL: Port binding = "impl: distancesoapbinding" name = "distance"> <Wsdlsoap: address location ="Http: // 192.168.0.26: 8080/axis/distance. JWS"/> </WSDL: Port> </WSDL: Service> </WSDL: Definitions> It should be noted that JWS web service publishing is a very simple web service publishing method. You cannot use packages on the page, and because the code is compiled at runtime, therefore, after deployment, it is difficult for you to find the error. |