Invocation of a Ruby object using the <mx:RemoteObject> MXML
declaration can be done in just a few simple steps. This
mini tutorial will guide through the setup and
configuration:
Download and install WebORB for Rails (use the
Getting Started guide if you need assistance with
this step).
Deploy the Ruby class you will be invoking from Flex into
/app/services folder of your Rails application.
Open /config/WEB-INF/flex/remoting-config.xml in a text editor and add a destination declaring your
Ruby class. Use the following format:
destination-name
must be the same literal as destination id from remoting-config.xml
remote-object-id is an id used in the MXML application to refer to a remote object
methodToInvoke is the method name available in the remote destination that your remote object can invoke
successHandler and faultHandler are function references your MXML application will invoke upon
successful or unsuccessful method invocation
Suppose the following Ruby class needs to be consumed by a Flex client (Note: WebORB will be able to
automatically load this class if it is placed within a file named MyRubyHelloWorld.rb and dropped into the /app/services directory).
class MyRubyHelloWorld
def sayWorld( string )
"Hey Flex"
end
end
then the destination declaration may look as the following: