Creating a Hessian service
Hessian is a remote method invocation technology; here, a client executes a method located on a server-the Hessian service. It uses HTTP, so it can go over proxies and firewalls. It also has implementations in multiple languages (PHP, Python, Ruby, and so on). So, for example, the client can use Java and the server can use PHP.
In this recipe, we will add a Hessian service to an existing Spring web application. It will expose the methods of a Java class.
Getting ready
The server will expose the methods of the UserService
interface:
public interface UserService { public abstract List<User> findAll(); public abstract void addUser(User user); }
The UserService
interface is implemented by UserServiceImpl
:
public class UserServiceImpl implements UserService { private List<User> userList = new LinkedList<User>(); public UserServiceImpl() { User user1 = new User("Merlin", 777); userList.add(user1); User user2 = new User...