Skip to content

Flex – Remoting with Java and Data Type

May 6, 2012

Steps for client to call the server API :
1. Define the destination in the remote-config.xml that uses a default channel (Channel definitions are in services-config.xml file .
2. Use that destination ID in your RemoteObject definition
3. Set the method name and its arguments in the definition
a. If you want to pass a custom object – you need to have an as class that
is mapped with Remote(Alias ) tag to your java object.
4. Set the result handler and the fault handler

To get the response back – you use the result handler.
To get the Custom Object our of result handler – use the API
var CustomObject:result = (CustomObject)event.getResult();

Get server side objects RemoteObject definition – which states which method to call,


        <mx:method name="setData">

IEventDispatcher ->DisplayObject

var result:MyClass = MyClass(event.result);

The class itself should use strongly typed references so that its dependencies are also linked.

Also ppl say better to load image at runtime then embedding as it increases cost – or use sprites instead.

You configure these requests by modifying the services-config.xml and remoting-config.xml files located in the /WEB-INF/flex/ folder for the web application.

The services-config.xml file defines different channels that can be used when making a request. Each channel definition specifies the network protocol and the message format to be used for a request and the endpoint to deliver the messages to on the server. The Java-based endpoints unmarshal the messages in a protocol-specific manner and then pass the messages in Java form to the MessageBroker which sends them to the appropriate service destination (you’ll see how to define these next).

In the remoting-config.xml file, you define the destinations (named mappings to Java classes) to which the MessageBroker passes the messages. You set the source property to the fully qualified class name of a Java POJO with a no argument constructor that is located in a source path,

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: