Release and invocation of Axis2 WebService

Source: Internet
Author: User
Tags wsdl

Release and invocation of AXIS2 WebService 1: Prepare:
Jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk6downloads-1902814.html
eclipse:http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/sr2/ Eclipse-jee-juno-sr2-win32.zip tomcat:http://tomcat.apache.org/download-60.cgi
axis2:http://axis.apache.org/axis2/java/core/download.cgi
The official Axis plug-in tool for Eclipse provides the ability to package AAR files and generate client calling code: http://axis.apache.org/axis2/java/core/tools/index.html

Among the service Archive Wizard-eclipse plug-in and code Generator Wizard-eclipse plug-in
Download the completed Software 1.1

Figure 1.12: Configuring the Environment:
2.1: Configure Java Environment variables (do not repeat).
2.1:eclipse AXIS2 Environment configuration: window->perferences->web Services->axis2 perferences->axis2 Runtime->Axis2 Runtime Location,browse Select the axis2-1.6.2 file directory to extract the Axis2-1.6.2-bin.zip from. 2.1.
Figure 2.1
2.2: Install plug-ins: Unzip Axis2-eclipse-codegen-plugin-1.6.2.zip and Axis2-eclipse-service-plugin-1.6.2.zip, put the resulting two jar packages into the Eclipse directory \plugins\, restart Eclipse.
2.3: Configure Tomcat: Unzip Apache-tomcat-6.0.36-windows-x64.zip (do not repeat).
2.4:eclipse in Tomcat configuration: Window->perferences->server->runtime environments added.
3: Release Axis2:
3.1: Unzip axis2-1.6.2-war.zip to get Axis2.war and put it into the WebApps folder of Tomcat decompression directory, launch Tomcat, enter http://localhost:8080/axis2/in the browser, Figure 3.1 appears, indicating that the configuration was successful.
Figure 3.1
3.2: Publish the Web Service with Eclipse's Axis2 plugin.
3.2.1 New dynamic Web Project in Eclipse, named Webserviceservice. Write a simple WebService server code
1 package org.web.service;
2
3 public class HelloWorldService {
4 public string SayHello (string name) {
5 return "Hello," + name;
6}
7}
8 3.2.2 In the blank workspace of Eclipse, right-new->other, in the popup dialog, find Axis2 Service archiver, double-click, select HelloWorldService Project Class path, 3.2
Figure 3.2
Next-> Check Skip wsdl,next-> do not fill next-> Select generate the service XML automatically,next->
Figure 3.3
If 3.3 Fill in the full path of the HelloWorldService class, click Load, in the method table below the SayHello description of load success, click Next->
Figure 3.4
Fill in the Output file location and click finish,3.4.
3.2.2 Right click on webserviceservice item, refresh. The My_service.aar file appears, 3.5.
Figure 3.5
Put this AAR file under%tomcat_home%\webapps\axis2\web-inf\services. Enter HTTP://LOCALHOST:8080/AXIS2/SERVICES/HELLOWORLDSERVICE?WSDL in the browser, and figure 3.6 shows that the publication was successful.
Figure 3.6
4: Generate the client calling code with Eclipse's Web Service client.
4.1: Right New->other->web services->web service Client at Eclipse's blank workspace, select, click next-> appear figure 4.1 Figure 4.1
Service definition fills out the WSDL path http://localhost:8080/axis2/services/HelloWorldService?wsdl,Client type default, Below the slide to pull up to the top, click on server Runtime:tomcat v6.0 server appears figure 4.2: Figure 4.2
Select default in Server Runtime, Web service runtime Select Apache Axis2, click OK, return to Figure 4.1, click on client project:webserviceclient, figure 4.3 figure 4.3
In the drop-down list of client project, select the project to which you are hosting code, and this example selects WebServiceClient. Click OK, return to Figure 4.1, click Next, go to the next link, then click Finish.
, Figure 4.4
4.4, source in SRC Folder appears under the Org.web.service package, below the Helloworldservicecallbackhandler.java and Helloworldservicestub.java files, Web App Libraries also has updates, in the WebContent directory also appears Axis2-web folder, as well as Web-inf and other updates.
4.2: Write WebService calling code.
Create a new client test file in the WebServiceClient project as follows:
1 package org.web.client;
2
3 Import java.rmi.RemoteException;
4
5 Import org

Release and invocation of Axis2 WebService

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.