Chapter 21. Web Services and Flash Remoting

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, ...

Get ActionScript 3.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.