File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Local / Remote / Web Service which one to invoke? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Local / Remote / Web Service which one to invoke?" Watch "Local / Remote / Web Service which one to invoke?" New topic

Local / Remote / Web Service which one to invoke?

ahmad namini
Ranch Hand

Joined: Aug 29, 2002
Posts: 52
Hi all:
I posted this message on the J2EE/EJB forum as well:
I am writing a P2P application using JBoss 3.20 (EJB 2.0) with Axis web services.
Every stateless session bean has a local and remote interface, as well as a proxy which can be invoked via a web service.
For performance, I am constantly invoking logic which does the following:
1. If the method required is local, invoke the local interface of the EJB.
2. If the method reqired is remote, invoke the remote interface of the EJB. If for any reason, JNDI port not open in the firewall, RMI call does not work (typically the call will timeout), invoke the method as a web service.
Obviously for performance, the local call is the best, followed by the remote call, and then the web service call. However, I cannot be certain that I can invoke a remote RMI call. However, I can be certain that the web service (over Http) will work.
My questions are as follows:
1. Is there a nice pattern, which incorporates the above stated details; and
2. Is it possible to 'ping' the JNDI or RMI port to see if a Remote call will work without having to rely on a timeout?
Thanks all.

-Ahmad<br />Sun Certified Java Developer (SCJD)<br />Sun Certified Java Programmer (SCJP)<p>"You got to be careful if you don't know where you're going, because you might not get there." -Yogi Berra
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Local / Remote / Web Service which one to invoke?
It's not a secret anymore!