Java RMI, Webservice & Web Service Framework

Hi,

I want two java programs to communicate with each other. Something like client server architecture, in which many clients are fetching data from server on regular interval (Say after 2-3 sec.).

With java RMI i am able to fetch data from server. But I would like to know is RMI the best solution?

I came to know that Web Service is better then RMI in terms of maintenance & flexibility.

Can anyone please tell for my requirement RMI better or Web Service?
Also, is their any Web Service Framework available which I can use?

Thanks
orazen12Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gurvinder Pal SinghCommented:
If one of them is client and the other is server, then web-service is definitely the way to go. And since in case of web-services, you dont need to have the server classes to be included in the classpath of service client. It will just be like invoking a servlet from browser client

Only thing i see in favour of RMI is, that i wont warrant you to deploy your code on server.

http://www.oracle.com/technetwork/articles/javase/index-137171.html
http://www.ibm.com/developerworks/webservices/library/wa-jaxrs/index.html

0
orazen12Author Commented:
I will go through ur link.

But my main issue is about performance.With web services is it possible to get real time data without any delay or any issue.


0
Gurvinder Pal SinghCommented:
for larger responses from server, RMI would be faster, since webservice would require the XML to be marshalled twice (request and response) and unmarshalled twice.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

for_yanCommented:

If you are interested in communication of two Java programs, and not need to get/provide service
to non-java sources I'd say that RMI  would be  a preferable way.
RMI has less overhead, it will be probably faster, does not require third party container and is simpler in implementation.

There are of course different opinions:
http://stackoverflow.com/questions/1941471/java-rmi-vs-web-services
but I'd rather vote for RMI.

 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
orazen12Author Commented:
for_yen & gurvinder372,

Thanks for ur replies.

Yes i want to bulid entire aaplication(Client Server)in java.& i dont think their will be any need to provide service to non-java sources.

I would like to know What is the impact of RMI & Web Service on network Bandwidth ?

I came to know that in RMI security needs to be monitored more closely to avoid hacking.
Is their any way to simplified it?

With RMI is it possible to find out which client is making call? Or i have to write seperate logic to handle clients.

Actually i am new to web services.So,not sure how to begin with it.
gurvinder372,i think JAX-RS is good alternative of RMI. Do you know any tutorial which can help me to code?


0
for_yanCommented:
RMI is totally in your hands - you are in fact writing both client and server - you can make sure
that you communicate which client is calling.

I was developing and using for many years RMI but it was all within the corporate enviroment behind
 firewall, etc. - it never occurred anything about security or hacking to me.

If you transfer data, then WebService will have to transfer more data than corresponding RMI,
as it will have additional wrappers, so any effect of RMI on bandwidth should be not bigger than that
of WebServices.
0
orazen12Author Commented:
for_yan,

if i am going to use RMI then page refreshing is handle automatically.Their will not be  any need to use ajax.Right?

Also,is it advisable to close the RMI session after every call?
0
orazen12Author Commented:
gurvinder372,

Thanks for the links.I will definately go through it.
0
for_yanCommented:
I was not thinking about RMI in this terms of servlet http connections.
It is more like simple server- client  connection. I set up server which is waiting for requests
from client. Client sends some request - server executes the requested method and returns the result.
There is no idea of page in my mind in connection with RMI (I think webService is the same way - it is not associated
with the idea of page). And so the session - you can communicate everything you need about the client to the server directly
so there is no problem with that. I think about it mnore as of distributed computing than as of web browsing - there is no
browser which interferes. One of most typical examples which i had is that say certain operations I need to execute on Unix environemnt
and most of my users know only Windows. So I maintain server on the Unix side and the
user from Windows will send request - the stuff will be executing on Unix and returning results
back to  Windows; user will not even know that it was excuting elsewhere.

Also with the applets - unsigned applet can connect only back to its own machine.
Suppose I want to store something to database from applet running on the client and
applet is loaded not from the same machine as the adtabase resides - I can then set up
RMI server on the same machine where Applet classes are sitting (RMI server is actually very lightweight)
and then I have a method in the RMI server, which receives the SQL command from Applet RMI client
and then stores data to database, as RMI server is of course not restricted in connection to any host.

Ajax is somthing related to JavaScript - so it is only relevant I guess with resct to browser where JavaScript is executed,
so RMI is not connected with browsers or JavaScript in any way

0
orazen12Author Commented:
for_yen & gurvinder372,

Thanks for your suggestions.For my requirement RMI is suitable.Still i would like to learn web sevices.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Services

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.