Creating an HTTP Invoker service
HTTP Invoker, like the Java RMI, is a Java remote method invocation technology; here, a client executes a method located on a server-the HTTP invoker service. HTTP is used instead of a custom port, so it can go over proxies and firewalls. However, it's a Spring technology, so both the client and the server must use Java and Spring.
In this recipe, we will set up an HTTP Invoker service that will expose the methods of a normal Java class. The service will be part of an existing Spring web application.
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...