• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between Java Servlet and Flash

 
Rob Proesmans
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear programming friends,

I have made an jsp/servlet application to manage appointments.

As an extra:
I am making a FLEX (flash) interface In Adobe flash builder, to manage these appointments with drag and drop functions etc..
But I have a problem: Is it possible to communicate in flash with java Servlets?

Maybe I have to export all my arraylists and parameters to arraycollections in flex (So I can build up my flash website with imported arraylists), or is there an easier way?

When I would make an appointment in flash, my servlet requires some parameters, is it possible to send them through?

I hope someone can help me, I have been googling this for hours. I haven't found a solution yet.
There was an earlier topic about this on javaranch, but the URL links they gave to help the guy out are all dead right now :'(

 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11915
209
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the mx:HTTPService tag?

Personally I would probably go with a RESTful web service on the Java side, but it is possible to interface with your existing web application if you must.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11915
209
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you are running the Flex app directly on top of the existing web application without adding a REST interface, here is some very simplistic code showing calling a web application through Flex:



Since you control the server, you can probably make sure the output is well formed XML, which would allow you to set the resultFormat to e4x and process it as an XML document.

The important thing is the answer to your question - you can see that on line 5 I am declaring a call to the HTTPService provided by Bing (because it is shorter to type than Google ) at http://www.bing.com/search. Then I pass the parameter "q" with the value "cheese" at line 7.
 
Rob Proesmans
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thank you man, so you suggest to export the data from the servlet (arraylists with objects in it) to XML.
And then import XML to Flex, is this the proper way to do it?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11915
209
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be interested in Flex chart from XML data using HttpService with Java Servlets - while the servlet code is pretty ugly, the overall concept shows what you need.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic