1.5. Communicating with Application Servers, Databases, and Directory Servers
Flash and the Flash Communication Server often must work with other
existing applications and resources. For example, users may have to
log in against an existing directory service or database before being
allowed to chat or view streams. Database systems can be used to
store large amounts of information that FlashCom cannot easily
manage, such as millions of records that represent the location of
video messages in a video email system. Each record might contain the
email text and the location of the recorded video message within a
FlashCom application.
Both the Flash Player and FlashCom can interact with web application
servers and, through them, database and directory
servers. The Flash client can call any server-side script available
on a web server, send and receive XML data, access web services, and
use the Flash
Remoting gateway to more efficiently access application servers. In
contrast, the Flash Communication Server (as of the latest version,
1.5.2) supports only Flash Remoting to connect to other servers. It
cannot directly consume web services, send or receive XML, or call a
CGI script, which often complicates designing applications that need
to access a database or other service already available via a web
server. However, Flash Remoting is a powerful and efficient
technology that can be used with J2EE, ColdFusion, and .NET servers
to provide access to databases or other services. Macromedia sells
the Flash Remoting gateway separately for J2EE and .NET servers and
bundles it with ColdFusion. There are also open source
implementations of Flash Remoting for Perl, PHP, and Java. See Chapter 11 for more details on Remoting, and see
http://opensource.org for
information on open source code.
Flash Remoting is a request/response technology that allows scripts
in the Flash client or FlashCom to call remote methods on an
application server. It uses HTTP to send and receive data in the AMF.
Those remote methods can retrieve information from a database,
directory server, or web server and return the information to
FlashCom. From a developer's point of view, Flash
Remoting is easy to work with because complex ActionScript data is
serialized and deserialized automatically. Flash Remoting can be used
with or without FlashCom. The point is that Flash Remoting is
flexible enough that it allows FlashCom to communicate effectively
despite FlashCom's lack of direct support for XML or
server-side script access.
Figure 1-5 illustrates some of the communication
options for Flash and FlashCom. A Flash client can access a web
application directly, as can FlashCom.

In some cases, clients may connect to both an application server and
FlashCom. In other cases, FlashCom may connect to the application
server and provide information from or to its clients. When many
clients need access to the same data, FlashCom should be used as an
intermediary between application servers. Application performance
will be improved by reducing the number of queries from each Flash
movie. When each movie needs to look up information unique to it, a
direct connection to an application server is usually a better
approach.
 |