On a recent project I needed to design 3-tier architecture system consisting of a rich-client application as the front-end, a middle tier J2EE-compliant server, and a database backend server. One of the design decisions that I had to make early on was how the front-end rich-client application would invoke remote methods on middle tier server components. What protocols or services would meet the project requirements?
To put everything in perspective, the proposed solution for the system, with the exception of the backend, was all Java-based. On the front-end we had an Eclipse RCP-based application, and a J2EE-compliant server sitting in the middle tier. What technologies are available to us that would allow a Java client application remotely invoke methods on server components? The alternatives that first come to mind are the following (in no particular order):
- Java RMI
- CORBA (IIOP)
- Enterprise JavaBeans (EJB)
- SOAP / WSDL / JAX-RCP
In this day and age we can pretty much rule out the first two. With the advent of the application server containers, Java developers spend most of their time writing either web tier components (Servlets/JSP) and/or EJBs (some might say to a lesser extent nowadays).
The buzz around Web Services and SOA in general are all the rage at the moment. It is therefore tempting to try to shoehorn solutions based on a WSDL/SOAP stack to every distributed, remote method invocation problem out there.
All the above technologies can be considered to some extent heavyweight solutions. In the case of EJB components you need a full-blown application server to deploy the EJB components into. The situation is probably a little bit better in the case of Java-based web services endpoints. You can deploy web services endpoints on servlet containers without the extra baggage of a full-blown application server. With SOAP you still need to deal with the marshalling and parsing of XML messages, which can put a strain on resources (depending on the volume of messages of course), and is slower when compared to other binary protocols. SOAP also imposes some limitations in the types of parameters it supports.
Don't get me wrong. These technologies all have a place in today's heterogeneous enterprise architectures. Web Services, with its message on interoperability and the promise of reusability (how many times have we heard that before) in highly heterogeneous environments, is carrying the flag and enjoying great press coverage.
Coming back to the problem at hand, I needed to be able to do the following:
- make some simple method invocations on a remote object or service;
- pass binary data (images) as input and output parameters to/from the server;
- invoke such methods in a stateless fashion.</li></ul>
It turns out there are other (perhaps "lesser known") technologies or protocols for performing remote method invocations that falls in the category of "lightweight" remoting. I'll briefly mention them here and pick up the discussion on my next installment.
- Hessian - is a slim binary protocol, based on HTTP; Language-independent but Java-oriented; currently mainly used for Java-to-Java remoting; available under the Apache license from Caucho (the makers of the Resin application server).
- Burlap - a sibling of Hessian, it is a slim XML-based protocol, based on HTTP; currently mainly used for Java-to-Java remoting as well; available under the Apache license from Caucho.
- Spring's HTTP Invoker - Java serialization of remote invocations over HTTP; combines the strength of HTTP-based remoting with the full power of Java serialization.
Comments
Not so fast! I like Java Remote Method Invocation, a top of the line interface by a top company.
This is the correct link for the 2nd part...
Part 2 of the blog entry is here.
Post new comment