The spring framework is often used to load JavaBean in today's Web applications. If you want to publish some of the JavaBean that are assembled in spring as WebService, it is easy to use the AXIS2 Spring-aware feature.
In the example of this article, in addition to the <tomcat installation directory >\webapps\axis2 directory and related libraries in the directory, you will need the Spring.jar file in the Spring framework to copy the file to the <tomcat installation directory >\ The Webapps\axis2\web-inf\lib directory.
The following is a JavaBean (the JavaBean will eventually be published as WebService) with the following code:
Package service;
Import entity. person;
public class Springservice
{
private String name;
Private String job;
public void SetName (String name)
{
this.name = name;
}
public void Setjob (String job)
{
this.job = job;
}
Getperson () {person
person
= new person ();
Person.setname (name);
Person.setjob (Job);
return person;
}
Public String getgreeting (string name)
{return
"hello" + name;
}
}
Where person is also a javabean, the code is as follows:
Package entity;
public class person
{
private String name;
Private String job;
Public String getName ()
{return
name;
}
public void SetName (String name)
{
this.name = name;
}
Public String getjob ()
{return
job;
}
public void Setjob (String job)
{
this.job = job;
}
}