tags:

views:

478

answers:

5

I have Java and Flash client applications. What is the best way for the two to communicate without special Flash-specific servers such as BlazeDS or Red5? I am looking for a light client-only solution.

+1  A: 

Well, you can make http requests from flash to any url... so if your java server has a point where it can listen to incoming requests and process XML or JSON, your flash client can just make the request to that url. BlazeDS and Red5 just aim to make it simpler by handling the translation for you making it possible to call the server-side functions transparently.

Aeon
Is it possible to tie in BlazeDS, Red5 to a normal Web server such as Tomcat?
Gili
Gili : yes, i do it.
Antoine Claval
A: 

WebORB for Java may be of some help to you. It integrates with your J2EE code.

For more info: http://www.themidnightcoders.com/weborb/java/

I'm sorry, I reread your question that you are only looking for a client side solution. In this case, WebORB will not help you. Sorry for the misunderstanding.

JP
+1  A: 

Are they running in a browser (applet and SWF), or are they standalone apps?

If they're running in a browser then you can use javascript. Both Flash and Java are can access javascript. It's fragile, but it works.

If they're running as actual applications then you can have Java open a socket connection on some port. Then Flash can connect to that and they can send XML data back and forth.

I've done both of these, so I know they both work. The javascript thing is fragile, but the socket stuff has worked great.

Herms
Doesn't Flash need special permissions to open a socket connection to an arbitrary address/port?
Gili
Depends on the context it's running in. If it's running in a browser then it can't do that. If it's running as an EXE (projector) then it works fine. I think it might work as well as a SWF running in the standalone player, but I don't remember.
Herms
A: 

MERAPI Bridge API

A: 

There's a Flash implementation of Caucho's Hessian web service protocol. This approach would be similar to using JSon or XML, but is more performant, since Hessian is a binary protocol. If you happen to be using Spring on your server, you can use the Spring/Hessian binding to call you Spring services directly from your Flash application with minimal work.

John Stauffer