Using Flash to Access the ColdFusion Server

     

Flash can be used to implement the client side of ColdFusion applications. A Flash client typically interacts with a ColdFusion server in one of two ways: using Web services or using Flash Remoting. Figure 32.2 shows the architecture and protocols associated with each approach.

Figure 32.2. The Flash Player (lower left) can access the ColdFusion server either using the WebServiceConnector component, or using Flash Remoting.
graphics/32fig02.gif

For more on dynamic data in Flash, see Chapter 23, "Using Flash for Dynamic Data," page 661 .


Web Services

The Web services architecture allows clients to get dynamic data from servers, making requests using Simple Object Access Protocol (SOAP) and receiving XML replies. By using standard, open protocols, Web services enable any-to-any communication. For example, you can create Web services that run on the ColdFusion server, and they can be accessed by clients using PHP, JSP, ASP.NET, or any other technology that supports Web services standards.

Note, however, that the Flash Player's prohibition on cross-domain data transfers without a cross-domain policy file puts a serious restriction on this potential for universal communication.

In addition, initial experience with the Flash Player and SOAP indicates that it may be best suited to non-demanding and non-critical applications.

For a link to results of some early testing on Flash Remoting and SOAP, see SOAPvsRemoting.htm on the CD accompanying this book.


For an introduction to the issue of cross-domain data transfers, see "New Security Rules," page 330 , in Chapter 14, "What's New in Flash MX 2004?". For relevant links, see crossDomainPolicyFiles.htm on the CD accompanying this book.


Web services are best accessed from the Flash Player through the WebServiceConnector component in Flash MX 2004 Professional. The WebServiceConnector makes it easy to get the basic Web services connection going.

For instructions on using the WebServiceConnector, see "Web Services," page 672 , in Chapter 23.


The Web services architecture requires the client to communicate with the server via a proxy, which replicates server behaviors on a local server, such as the ColdFusion server.

Dreamweaver has tools for creating ColdFusion server behaviors for use as Web services. Dreamweaver also makes it easy to create the proxy for the client on the ColdFusion server. Finally, Dreamweaver makes it easy to create simple client interactions with Web services.

For more on Dreamweavers tools for auto-generating the proxy and Web service client code, see "Consuming Web Services," page 316, in Chapter 13.


Flash Remoting

To use Flash Remoting, you have to download the Flash Remoting components from www.macromedia.com.

For instructions on using Flash Remoting, see Chapter 23, "Using Flash for Dynamic Data," page 661 .


Flash Remoting clients communicate via the Flash Remoting Gateway, a standard feature of the ColdFusion server. The Flash Remoting client invokes a function, created by the ColdFusion developer and often contained in a ColdFusion component (CFC) on the ColdFusion server. The function returns a value to the Flash Remoting client.

Flash Remoting is the most efficient way to communicate with the ColdFusion server. The ColdFusion server and the Flash client store data in the same format, eliminating the need for time-consuming translation required with technologies like XML. In addition, the proprietary Action Message Format (AFM) used for communication between client and server is efficient and compact.



Using Macromedia Studio MX 2004
Special Edition Using Macromedia Studio MX 2004
ISBN: 0789730421
EAN: 2147483647
Year: N/A
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net