Create a Web service using AXIS2

Source: Internet
Author: User
Tags wsdl

Axis2 is a new generation of Web service development tools, currently the latest version is 1.5. This article mainly describes how to create a Web Service with Axis2.

First download the binary package and the war package, copy the war package to the Tomcat WebApp folder, open the browser access Http://localhost:8080/axis2,war package will be automatically decompressed, generate Axis2 folder, The following page is displayed in the browser (if you do not respond temporarily, refresh several times).

Then download the Service Archive Wizard and Code Generator Wizard two eclipse plugins and install them. The former is used to create a Web service, which generates stubs based on WSDL to invoke Web service and can generate WSDL through stubs. After installation, right-click in the Package Explorer to select New->other, you can see the following two wizard templates in the Open Wizard selection screen.

Next we started to develop a web Service. Start by creating a Java project Net.kirin.webservice, then create a package with the same name, create a new Calculateservice class under the package, and write the following code:

 Package Net.kirin.webservice;  Public class Calculateservice {    publicdouble Add (doubledouble  y) {         return x + y;    }}

Then create a new Axis2 Service archiver Wizard and click Next to open the following interface:

Select the directory where the project is located in the class File location and click Next to open the WSDL selection interface.

Here we choose Skip WSDL and click Next to open the external jar selection interface.

Since the project we are building does not reference any external jar, direct next opens the XML selection interface.

Here we choose to generate an XML file automatically, click Next and open the interface to generate the XML file.

Enter the name of the Web service in the service name, enter the full path to the class name, and then click Load, and the list will show all the methods of the class (including the method inherited from Java.lang.Object), select Search Declared methods only check box, the remaining methods will be filtered out in the list, only the custom Add method remains. Click Next to open the output interface of the Archiver file.

Fill in all the options and click Finish to finish. If all goes well, you will see the following interface, the service published successfully.

Open the E:\webservice folder and you will see the generated Calculateservice.aar file. Copy the file to the Webapps/axis2/web-inf/services folder in the Tomcat installation directory. Start Tomcat and open Http://localhost:8080/axis2/services/listServices as follows:

Click the Calculateservice link to open the http://localhost:8080/axis2/services/calculateService?wsdl as follows:

At this point, the Web service was published successfully.

This article transferred from: http://www.cnblogs.com/kirinboy/archive/2009/09/21/1570980.html

Create a Web service using AXIS2

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.