Samitha Chathuranga
Samitha Chathuranga

Reputation: 1749

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.

Upvotes: 1

Views: 940

Answers (1)

Zack Dawood
Zack Dawood

Reputation: 2230

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

Create new dynamic web project

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

AXIS2_HOME\Sample\pojo

Copy POJO source to the dynamic web source

Create a new Webservice from Eclipse

enter image description here

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,

enter image description here

Click Finish

enter image description here

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

enter image description here

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");

enter image description here

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();

enter image description here

All Set response from SOAP UI

enter image description here

enter image description here

Response from Client Java Code

enter image description here

Upvotes: 1

Related Questions