Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI over HTTP  RSS feed

 
Austin Hoffman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!,
Can anybody tell me if RMI can work over HTTP and if it is being implemented anywhere.
Regards,
Austin
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find information about RMI over HTTP (usually called "http tunneling"... you'll probably find more info by googling that term) in the JGuru RMI FAQ under the heading "Firewall Issues". I also seem to remember that the O'Reilly "Java RMI" book had an example of this...
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Austin,

This doesn't directly address your question specifically as it doesn't use RMI but you might want to consider taking a look at a couple of firewall friendly lightweight HTTP based remoting protocols from Caucho: Hessian and Burlap.

Both products are mature, stable, and have a commercial developer friendly Apache license. Hessian is a lightweight, self-describing binary RPC protocol. Burlap is a lightweight XML RPC protocol.

Hessian is probably a better choice for Java-to-Java comms as it's slimmer and therefore more efficient.


You might also want to take a peek at Spring as it makes working with remoting through RMI, Hessian, Burlap, and etc. easier.

On the client side, you a declare a bean that is a factory for generating a proxy that implements your business interface and defines the URL for connecting to your service.

When using Spring in this fashion, there are no low level exceptions that you are forced to catch like RemoteException. If there is a problem, Spring will throw a RemoteAccessException, which is a RuntimeException for any of the supported remoting protocols. With this method, you only need catch the exception at some high level part of your application where it can be more effectively dealt with.

On the server side, you declare a service exporter bean that implements your business interface and delegates to a plain old non-remoting aware object that is the actual implementation of your business service. This object can then also provide its services locally and is easily unit tested.

This approach makes switching between remoting strategies very easy, mostly a matter of simple configuration and adding the appropriate jar file to your app.

There is a good chapter with examples on this in "J2EE Development without EJB" by Rod Johnson and Juergen Hoeller. You might want to browse this when you're in the bookstore.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The grandaddy of all RMI-over-HTTP is Web Services. This is the SOAP-based protocol, and it has the downside of being heavy (lots of overhead), but it's language-independent.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't call SOAP the granddaddy of RMI.
After all, SOAP was created around 2000/2001, while RMI has been around since 1997 or so

The granddaddy of RMI is RPC.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!