4.1. Essentials of Remoting

Remoting, simply put, is remote procedure calls (RPC) over the wire. Flex client applications can use RPC to communicate with remote Java objects that expose their methods as services. Such client applications can pass parameters to these remote Java objects and receive the result of these remote procedures. Java programs obviously take Java data types as inputs and return Java data types from its methods. A Flex client, on the other hand, is written in ActionScript 3 (AS3) (and its associated XML-based declarative language, MXML), so it sends and receives only AS3 objects. The remoting infrastructure needs to make the two languages talk to each other and map the data types in one language to the data types in the other. BlazeDS provides this essential infrastructure, which, apart from providing the translators, includes the communication protocol and the convenience classes that make RPC happen in an effective and efficient manner. Figure 4-1 attempts to put this definition of remoting in a diagram.

Figure 4.1. Figure 4-1

For successful remoting, components exist both on the client and the server. These client-side components act as stubs or handles for their server-side service counterparts. Client-side programs call the remote methods on these handles as if they were local. On receiving a remote procedure call, these client-side components pass ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® 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.