[flexcoders] Re: Flex and Java Communication

2008-12-05 Thread valdhor
Ryan

Thanks for the response.

I tried to checkout wicket but it keeps asking me to authenticate.


--- In flexcoders@yahoogroups.com, Ryan Gravener [EMAIL PROTECTED] wrote:

 http://code.google.com/p/wicket-flex-blazeds/
 
 Ryan Gravener
 http://ryangravener.com/flex | http://twitter.com/ryangravener
 
 
 On Thu, Dec 4, 2008 at 4:00 PM, valdhor [EMAIL PROTECTED] wrote:
 
Hmmm
 
  I'm wanting to learn Java and I already know Flex.
 
  The book mentioned comes from the other direction (Already know Java
  and want to learn Flex).
 
  Are there any resources/tutorials etc for someone like me who wants to
  learn Java for use with BlazeDS/LCDS. I already know C++ so the
  language itself is pretty easy. I get bogged down on how to create the
  server side application and connect it to Flex.
 
  Can anybody point me in the right direction?
 
   
 





[flexcoders] Re: Flex and Java Communication

2008-12-04 Thread simonjpalmer
--- In flexcoders@yahoogroups.com, saritha [EMAIL PROTECTED] wrote:

 Hi,
 
 How to communicate between Flex and Java?


There are two main ways and which you choose depends largely on the
future needs of your clients.  

If you need a generic API on your server because you are going to
implement a variety of clients, or you want to open up your
application for other people to code against, then a web service on
the Java end and HTTPService in your Flex code is definitely the way
to go.

However, if you are looking for speed and small packet size and
squeezing the most out of your app, then you should use AMF via RPC,
i.e. remote objects and BlazeDS.  You'll have a tight binding between
your types on both sides and the API can be very clean and tailored
specifically to your needs.  I find it more elegant and there's less
code to maintain.

I have used both but prefer the remote object approach as I think that
coding for possible future scenarios tends to unnecessarily dilute my
current app and I'd prefer to take the performance advantages of AMF.
 It's a trade-off I am happy to make and you need to make the same
judgement.



[flexcoders] Re: Flex and Java Communication

2008-12-04 Thread valdhor
Hmmm

I'm wanting to learn Java and I already know Flex.

The book mentioned comes from the other direction (Already know Java
and want to learn Flex).

Are there any resources/tutorials etc for someone like me who wants to
learn Java for use with BlazeDS/LCDS. I already know C++ so the
language itself is pretty easy. I get bogged down on how to create the
server side application and connect it to Flex.

Can anybody point me in the right direction?



Re: [flexcoders] Re: Flex and Java Communication

2008-12-04 Thread Ryan Gravener
http://code.google.com/p/wicket-flex-blazeds/

Ryan Gravener
http://ryangravener.com/flex | http://twitter.com/ryangravener


On Thu, Dec 4, 2008 at 4:00 PM, valdhor [EMAIL PROTECTED] wrote:

   Hmmm

 I'm wanting to learn Java and I already know Flex.

 The book mentioned comes from the other direction (Already know Java
 and want to learn Flex).

 Are there any resources/tutorials etc for someone like me who wants to
 learn Java for use with BlazeDS/LCDS. I already know C++ so the
 language itself is pretty easy. I get bogged down on how to create the
 server side application and connect it to Flex.

 Can anybody point me in the right direction?

  



[flexcoders] Re: Flex and Java Communication

2008-12-03 Thread oneworld95
There are a couple of different ways. To start, you can use a servlet
that generates XML and use an HTTPService in Flex. A more
sophisticated option is to use the free BlazeDS data service tool to
pass objects between Java and Flex. 

For the first option, you can create an HTTPService like this,

import mx.rpc.http.HTTPService;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;

private function getServletXML():void {
  var service:HTTPService = new HTTPService();
  service.cancel(); // good idea to cancel service first.
  service.url = http://myserver.com/MyXMLServlet;;
  service.resultFormat = e4x; // Makes XML nodes accessible in
ActionScript
  service.contentType = application/xml;
  service.addEventListener(ResultEvent.RESULT, serviceResultHandler);
  service.addEventListener(FaultEvent.FAULT, serviceFaultHandler);
  service.send();
}

private function serviceResultHandler(event:ResultEvent):void {
  var myXML:XML = XML(event.result);
  // here you'd do something with the myXML object, such as bind it to
a datagrid
}

private function serviceFaultHandler(event:FaultEvent):void {
  Alert.show(event.fault.message,Could not read XML servlet.);
}   

You can look at this page for an example of connecting a servlet to
Flex:
http://blog.kevinhoyt.org/2007/12/07/flex-to-java-servlet-file-upload/

Another example: http://learn.adobe.com/wiki/display/Flex/2b.+Code+Files

To produce efficient XML in Java, look up the examples on this page,
http://www.javazoom.net/services/newsletter/xmlgeneration.html

-Alex

--- In flexcoders@yahoogroups.com, saritha [EMAIL PROTECTED] wrote:

 Hi,
 
 How to communicate between Flex and Java?