Axis2 + myeclipse6.0 released Java WebService

Source: Internet
Author: User


1. First install the axis2 plug-in myeclipse, Which is troublesome and in various situations.



2. axis2.jar package download address:, my version is1.5.6


3. Generate yourprojectname for the server project

Reference: use Part 3: Methods in standalone deployment.

Copy three axis2 related folders and web. xml under Web-info, and modify the service name yourservicename and method name yourmethod in services. xml.

For example, testws:

Package ws; public class testws {Public String showname (string name) {return name;} Public String getname () {return "Hello, axis2, by getname method .";}}

Services. XML is configured as follows:

<Service name = "axisservice"> <description> axisservice </description> <parameter name = "serviceclass"> ws. testws </parameter> <operation name = "showname"> <messagereceiverclass = "org. apache. axis2.rpc. receivers. rpcmessagereceiver "/> </Operation> <operation name =" getname "> <messagereceiverclass =" org. apache. axis2.rpc. receivers. rpcmessagereceiver "/> </Operation> </service>


Project name: axis2service

Deploy it in Tomcat to verify whether the service is normal:

Http: // localhost: 81/yourprojectname/services/yourservicename? WSDL

Http: // localhost: 81/axis2service/services/axisservice? WSDL


4. Generate a client for testingProgram

Use the installed axis2 plug-in "axis2 code generator" to generateCodeTo the specified project.

Test class:

Package test; import ws. axisservicestub; public class clienttest {public static void main (string [] ARGs) throws exception {axisservicestub stub = new axisservicestub (); axisservicestub. showname command = new axisservicestub. showname (); command. setname ("Hello, axis2, by showname method. "); string shownamertn = stub. showname (command ). get_return (); system. out. println (shownamertn); string getnamertn = stub. getname (). get_return (); system. out. println (getnamertn );}}


Hello, axis2, by showname method.
Hello, axis2, by getname method.


Related Article

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: 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.