Building Flash-based websites using Flex
Lesson 6 – Remote Server Communication
by Alex goh, associate trainer @ LAB School ( http://lab.edu.sg/ ), Adobe Authorized Training Centre, Singapore
2. Agenda
● Remote data communication
● Real-time communication
● Asynchronous communication
● HTTP Get/Post
● Flash remoting
3. Remote Data Communication
● Flex offers many ways to communicate data to and from a remote server.
● The first step is to determine whether a real-time (synchronous)
communication or a “request-response” (asynchronous) communication is
needed.
4. Real-time Communication
● Real-time communication is harder to implement.
● Need to use sockets to establish permanent connection. Many companies
block socket connection as part of their system security measures.
● In Flex, real-time communication requires Adobe's Real Time Messaging
Protocol (RTMP).
● To use RTMP, requires Adobe's LiveCycle ES (requires licensing) or BlazeDS
(open source), both implemented on the J2EE platform.
●Used mostly in video conferencing app, or instant messaging. e.g. Yahoo
Web Messenger was done in Flex
5. Asynchronous Communication
● Make use of the HTTP/HTTPS protocol
●Connection to a remote server is achieved either thru the REST or SOAP
method.
● REST method:
● HTTP Get/Post – HTTPService class
● Flash remoting – RemoteObject class
● SOAP method:
● Web service – WebService class
6. HTTP Get/Post
● Use the HTTPService class.
● Simplest.
● Most web APIs use the HTTP Get/Post method
7. Flash Remoting
● More secured.
● Convenient the Flex application can simply call a function on the server side,
known as Remote Procedure Call (RPC) or Remote Method Invocation (RMI).
● Adobe came out with a format to support binary data transfer to be used in
conjunction with Flash Remoting, called the Action Message Format (AMF).
● Both LiveCycle ES and BlazeDS support AMF, but that means the server
needs to run J2EE.
● For other types of application server (ASP, PHP, Ruby...etc), need to use third
party software.
● WebOrb (free, pay for support) - http://www.themidnightcoders.com/