简体   繁体   中英

How to import an Axis2 sample project into eclipse?

How to import an Apache Axis2 sample project into eclipse ? I tried to import the project named pojo, but no success.. What folder to import??? It seems that normal importing method doesn't work here.

Create a new dynamic web project in Eclipse (You need to have Eclipse J2EE version)

创建新的动态Web项目

Copy the sample pojo source code from the AXIS2_HOME\\sample directory to the dynamic web project source code directory

AXIS2_HOME \\样本\\ POJO

将POJO源复制到动态Web源

Create a new Webservice from Eclipse

在此处输入图片说明

Select Bottom Up and Select the AddressBookService in the package sample.addressbook.service

Make sure you select Axis, and the Project name. Also check the Client options as below,

在此处输入图片说明

Click Finish

在此处输入图片说明

Move the client code to the client project PojoClient (AddressBookADBClient in package sample.addressbook.adbclient

在此处输入图片说明

Refactor the package name and methods to fit the stub automatically generated

I have made 3 changes Modified the package name to match the stubs

1) //import sample.addressbook.stub.AddressBookServiceStub;
import sample.addressbook.service.AddressBookServiceStub;

Modified the method name to match the stubs

2)//addEntry.setArgs0(entry);
   addEntry.setEntry(entry);

Modified the method name to match the stubs

3) //findEntry.setArgs0("Abby Cadabby");
    findEntry.setName("Abby Cadabby");

在此处输入图片说明

One final change in the service, since i was not able to get the test it. I made the entries variable to static
private static HashMap entries = new HashMap();

在此处输入图片说明

All Set response from SOAP UI

在此处输入图片说明

在此处输入图片说明

Response from Client Java Code

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM