Section 21.0. Introduction


21.0. Introduction

Remote procedure calls (RPCs) are a powerful way to build distributed and robust applications. RPC is essential for most Flash platform applications. For example, you can use RPC to send data to the server from Flash Player or retrieve data from the server to display to the user. There are many ways for making remote procedure calls from Flash Player; however, there are two ways that stand out: web services and Flash Remoting.

When referring to web services in this book, the focus is on Simple Object Access Protocol (SOAP). Web services of this type use SOAP for communication between the server and client. SOAP can serialize complex datatypes, which means you can call server-side methods from a client and pass it parameters of both simple (numbers, strings, and Boolean values) and complex types (objects.) The server-side method can even return complex data to the client, such as arrays, Date objects, and even custom datatypes. SOAP web services are supported by nearly every platform, including Java, ColdFusion, PHP, .NET, and Perl to name a few. Flash Player, however, does not have built-in web services support, and it doesn't natively understand SOAP either.

However, Flash Player can communicate over HTTP, and it can parse XML data. Since SOAP web services communicate over HTTP and SOAP is an XML-based protocol, it is possible to use ActionScript to call web services methods.

Flash Remoting is very similar to web services, but with a few significant advantages:

  • Flash Remoting uses HTTP as well, but rather than using SOAP, it uses a binary protocol called Active Messaging Format (AMF). Since AMF packets are binary, you can send much more data across the wire at much less expense. The result is that Flash Remoting is faster than other web services.

  • Flash Remoting is natively supported by Flash Player.

  • Flash Remoting is also available for Java, ColdFusion, .NET, and Perl, though it is quite likely that there are many less prominent platforms that support web services that don't currently support Flash Remoting.

Flash Remoting and Web services both make asynchronous requests to service methods, and both can be used to create sophisticated client-server applications. The recipes in this chapter look at how to work with these technologies.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

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