Monday, October 6, 2008

Difference between Remote Procedure Call (RPC) Services: HttpService, Remote Objects, and Web Services in Flex

I would like to use the Flex Data Services (FDS) especially since I really want to see if Adobe/Macromedia has made Data Management and Messaging simpler, I might research the FDS Express later on; but I want to get up and running, so here we go. For right now, the RPC calls are built-in to the Flex SDK and Flexbuilder, so I got to go with what I got.

Basically, Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3.

“RemoteObject provides two advantages over HTTP or SOAP. First, while the AMF protocol uses HTTP to transfer packets, the data is transferred in a binary format that is natively understood by the Flash Player. As a result, data can move across the network more quickly and it can be deserialized more rapidly than text-based formats such as XML. Both of these result in performance gains, particularly where large sets of data are involved. Secondly, RemoteObject provides signficant productivity advantages. The remoting service, which runs on your server, automatically marshalls data between AMF and your server-side language (e.g., PHP, Java, C#). As a result, you can directly call methods on your PHP objects without having to write an XML REST interface or create web service interfaces”.

So which one to choose? As far as I’m concerned, I use little data sets so receiving data over the HTTPService has been a cinch. If I ever have to go through a larger data sets, I’ve looked at AMFPHP and found version 1.9 was very good and easier to configure then others. Again, this will probably be something that I’ll have to further research.

References:

http://store1.adobe.com/devnet/flex/articles/refactoring_flex.html
The article explains how to refact flex and about the data management services in FDS.

http://www.adobe.com/devnet/flex/articles/rpc_service.html
An article about Flex’s RPC services

http://www.adobe.com/devnet/flex/articles/remoteobject_sabreamf.html
Article about the other PHP Remoting framework, SabreAMF.

No comments: