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 ...

Get Spring Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.