1.download the axis2-1.6.2-bin.zip,axis2-1.6.2-war.zip file. Copy the axis2.war file in the unzip compressed file to the % TOMCAT-HOME % webapps directory, and then start
Preparations 1. Download The axis2-1.6.2-bin.zip,axis2-1.6.2-war.zip file. Http://axis.apache.org/axis2/java/core/download.cgi 2. Environment Variable configure AXIS2_HOME JAVA_HOME 3. Copy axis2.war in axis2-1.6.2-war.zip ZIP file to % TOMCAT-HOME %/webapps directory, then start
Preparations
1. Download The axis2-1.6.2-bin.zip,axis2-1.6.2-war.zip file. Http://axis.apache.org/axis2/java/core/download.cgi
2. environment variable configuration
AXIS2_HOME
JAVA_HOME
3. Copy axis2.war in the axis2-1.6.2-war.zip ZIP file to the % TOMCAT-HOME %/webapps directory, and then start Tomcat
Access http: // localhost: 8080/axis2/to check whether it is normal.
Click Services to go to the service list page. Currently, there is only one Version service.
4. Download The axis2-eclipse-codegen-wizard.zipand axis2-eclipse-service-archiver-wizard.zip plug-ins.
Http://archive.apache.org/dist/ws/axis2/tools/1_4_1/
Decompress the package and obtain two folders: Axis2_Codegen_Wizard_1.3.0 and Axis2_Service_Archiver_1.3.0. Copy them to eclipse \ dropins.
Note that the test fails and is not recommended. Download the axis-eclipse-codegen-plugin-1.6.2.zipand axis-eclipse-service-plugin1.6.2.zip files, decompress them, and copy the plugins to the % ECLIPSE_HOME %/plugins/directory. Http://mirrors.cnnic.cn/apache/axis/axis2/java/core/1.6.2/
5. After the installation is complete, select new-> other with Axis2 Wizards in IDE, indicating that the plug-in has been installed successfully.
AXIS2 releases Web Services1. engineering documents
Create an Axis2Service1 java project;
Create the/Axis2Service1/src/ws/TestWs. java file;
package ws;public class TestWs {public String showName(String name){return name;}public String getName(){return "Axis2Service Sample";}}
Ii. aar deployment Method
1. Manually package
Create the/Axis2Service1/deploy folder and copy the following class under the/Axis2Service1/bin/directory;
New/Axis2Service1/deploy/META-INF/services. xml file
AxisService
ws.TestWs
2. Plug-in Packaging
In the IDE, choose New> other> Axis2 Service Archiver and click Next;
In Class File Location: select the Axis2Service1 \ bin directory and click Next;
Select Skip WSDL and click Next;
Select the jar location for the Service Archiver. If no jar package exists, click Next;
Select Generate the service xml automatically to automatically Generate the XML file, and click Next;
Service name, enter AxisService (you can set the name), enter the class to be released (full path) in class name, click load, select search declared methods only, and click Next;
Output File location, output File Name enter the Name of the artiver File AxisService. Click finish. The message "Service Archvie generated successfully" is displayed! Indicates that the generation is successful.
3. Release AxisService
AxisService. aar copies to % TOMCAT-HOME %/webapps/axis/WEB-INF/services. (Do not pack aar,/Axis2Service1/deploy/. You can copy the following package)
Open http: // localhost: 8080/axis2/services/listServices. The following page is displayed:
AXIS2 calls Web ServicesI. client stub file generation
1. Script Generation Method
Run the following command wsdl2java-uri http: // localhost: 8080/axis2/services/AxisService in the % AXIS2_HOME %/bin/directory? Wsdl-p ws-s-o stub Description:-p specifies the registration of the generated java class;-o specifies the directory for saving a series of generated files; automatically generate AxisServiceStub in stub/src/ws. java
2. Plug-in Generation Method
In IDE, choose New> other> Axis2 Code Generator and click Next;
Check Generate Java source code from a SWDL file and click Next;
WSDL file location input: http: // localhost: 8080/axis2/services/AxisService? If the wsdl is correct, click Next;
Specify the input path and click Next;
Prompt All operation completed successfully! Generated successfully. A series of stub files are automatically generated in D: \ src \ wc, where ws is the package name;
Note: error An error occurred while completing process-java.lang.reflect.InvocationTargetException Solution
1. Copy "geronimo-stax-api_1.0_spec-1.0.1.jar" and "backport-util-concurrent-3.1.jar" from the LIB library of AXIS2"
File to the lib directory of Axis2_Codegen_Wizard_1.3.0, and modify Axis2_Codegen_Wizard_1.3.0
Add the following to the plugin. xml file:
If there is no backport-util-concurrent-3.1.jar, you can download from address: http://backport-jsr166.sourceforge.net.
2. Delete the Axis2_Codegen_Wizard directory under $ workspace location \. metadata \. plugins.
3. Switch to the $ ECLIPSE_HOME directory under the command line, and then execute: eclipse-clear.
If the problem persists, refer to the following solution: Modify the name and change it back.
Ii. Client call
The script generation method is similar to that of the plug-in.
1. Create a java project Axis2Client;
Copy the jar package under the % AXIS2_HOME % \ lib \ directory to \ Axis2Client \ lib \ and add it to the project reference. A single AxisServiceStub generated by the script will be generated. add the java file to src \ ws and;
2. Create TestWs. java code as follows:
Package ws; import java. rmi. remoteException; public class Axis2Client {public static void main (String [] args) throws RemoteException {// initialize Stub class AxisServiceStub stub = new AxisServiceStub (); // pass AxisServiceStub. showName object. related parameters are assigned AxisServiceStub here. showName command = new AxisServiceStub. showName (); command. setName ("Hello! "); // Get the returned value String name = stub. showName (command). get_return (); System. out. println (name );}}
3. After the call is successful, the console outputs: Hello!