3.27.2006

Flex 2 and Remoting.

I am comfortable with the .Net remoting and AMFPHP in both Flash MX and AS2. I was wondering how I will call a remote method from the flex client. This question has lead me to understand how flex client and Flex Enterprise Sever communicates with each other.

I have found the following three types of data Services in FES 2.

  • Flex Data Service
  • Flex Message Service
  • RPC Services

Today I want to focus on RPC Services only.

A Flex client can access back-end data using SOAP-based web services, web services (XML over HTTP), or by directly invoking methods in remote objects deployed in the application server.

In Flex Data Services, these three alternatives are collectively referred to as RPC services. In general, using the RPC approach, In this approach we typically start by invoking a method on a remote service to obtain a set of data.

After going through all these I know you would ask me to stop theory and show you the steps to do remoting in Flex 2.

Well,I know you are right if you said so.There are plenty of documentation around to explain how flex data service works.

Flex uses remoteObject tag to directly invoke methods in Java objects deployed in the application server.

In Flex 2.0, every remote object must be configured as a Remoting Service destination in the
flex-enterprise-services.xml file, or a file that it includes by reference. You reference a
destination in the destination property of the tag.You will find this file in your webapp folder of the FES where you will deploy your Flex Application.

flex-enterprise-services.xml file:

samples.explorer.EmployeeManager
true

Flex 2.0 syntax

In Flex 2.0, you use the destination attribute to identify which Remoting Service
destination to use. In the configuration file, you define a destination.
MXML tag:

I put some more light on this soon. Stay tuned...


No comments: