Now that we have gone through the rudimentary of a Hello World program,
Time to start digging deeper. In this section we will explore following
features of Axis using Address Book Example
Service end point internals
Service clients
Download Address Book source code discussed
in this lesson.
Source code of AddressBook value object is given below. This class is
a simple POJO with getter and setter methods for following data
First Name
Last Name
Phone Number
Address
package demo.data;
public class AddressBook{
String firstName;
String lastName;
int phoneNumber;
String address;
public void setFirstName(String firstN){
firstName = firstN;
}
public String getFirstName(){
return firstName;
}
public void setLastName(String lastN){
lastName = lastN;
}
public String getLastName(){
return lastName;
}
public void setPhoneNumber(int phone){
phoneNumber = phone;
}
public int getPhoneNumber(){
return phoneNumber;
}
public void setAddress(String addr){
address = addr;
}
public String getAddress(){
return address;
}
}
Now create a service class which is again a value object with get and
set for AddressBook class
package demo.service;
import demo.data.AddressBook;
public class AddressBookService{
AddressBook address;
public void setAddressBook(AddressBook address){
this.address = address;
}
public AddressBook getAddressBook(){
return this.address;
}
}
The above xml describes following parameters for a service
The name of service is "AddressBookService"
The scope of this application is application wide
Message receivers(Message Exchange Patterns (MEPs) defined are
- RPCInOnlyMessageReceiver for in-only method setAddressBook()
- RPCMessageReceiver for in-out method getAddressBook()
The service class parameter is defined as demo.service.AddressBookService
which defines the various operations or methods.
Apart from the message receivers mentioned above some of the other popular
message receivers for other non POJO data bindings are
Finally build the service using build file target generate.service.
To get this target in Eclipse double click on the build.xml in the project
explorer panel, all the ant build file targets will be visible in a new
window called outline. Right click on generate.service
and run as ant build. Upload the generated arr file to services folder
of axis installation.
finnaly check the service availability in AXIS's service console. In
the next section we will develop a service client to access Address Book
service end point