Axis2 WebService Getting Started--webservice release and invocation

Source: Internet
Author: User
Tags wsdl

First, WebService released

Reference http://www.cnblogs.com/demingblog/p/3263576.html

Second, WebService call part reference: http://www.cnblogs.com/demingblog/p/3264688.html

Generating client code using the AXIS2 plug-in in MyEclipse

New-->others to the following interface:

Click Next to the following interface:

Now we want to generate the client code that calls WebService, first we need to generate a service.wsdl file, select 2nd, click Next,

In the interface click Add Folder Select Item-"webroot--" webinf-->classes, Input good webservice that class full name and click Test Class Loading, this time if you choose the path is right, Class full name is right, you can click Next, otherwise Next button-style gray.

then click Next, the content of this interface is basically not modified, there is a service name, you can change to your own to take.

go on. Next Select the output path of the WSDL file in the interface, select the first one, the output to the current workspace, select the second, the output to the system folder, for example, you can choose the desktop.

Here I choose the second one, then click Browse to select the desktop, click Finish, you will see a service.wsdl file on the desktop.

Here we can generate the client code based on this WSDL file.

First build a Web project, for example named MyClient

New-->others-->

Select 1th, click Next.

Click Browse in the interface to find the service.wsdl file you just generated.

Click Next, this interface does not have to tube, continue to point next.

Click Finsh, Refresh MyClient project will see some Java files under SRC

ImportCom.paic.services.SayHello;Importcom.paic.services.TestServiceStub; Public classClient {/**     * @paramargs *@throwsException*/     Public Static voidMain (string[] args)throwsException {//TODO auto-generated Method Stub//Initialize Sub class, publish address (? Before the WSDL section)Testservicestub stub =NewTestservicestub ("Http://192.168.100.47:8080/axis2/services/MyService"); //Pass the Axisservicestub.showname object, and the relevant parameters are assigned here. SayHello Command =NewSayHello (); Command.setname ("Jack"); //get the return value SayHello an object is passed here, and the object is an assigned instance of SayHello, and the return type is an object of type Sayhelloresponse.String name =Stub.sayhello (command). Get_return ();    SYSTEM.OUT.PRINTLN (name); }}

Axis2 WebService Getting Started--webservice release and invocation

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.