How does a Rails developer talk to the outer ends of Flex?

I see Rails development as a backend for a Flex application and try to figure out the level of communication between a Rails application and Flash Player. Everything I find suggests using SOAP web services for communication.

However, Flash supports AMF, which is good and fast (and native). Is there a way to communicate via AMF with a Rails application, supporting all the “nice” things about AMF (automatic type conversion, push data, etc.).

+3
source share
7 answers

WebORB RubyAMF, AMF Rails, , . RubyAMF Flexible Rails, Rails Flex.

+3

rails/flex, JSON- REST. HTTP- Flex, JSON, . XML .

, , PureMVC , .

+2

- SOAP, "" - REST, Rails. , DEFusion, : FLEX Rails REST ( XML).

AMF Adobe , FLEX- CodeFusion , , Java- . , Adobe BlazeDS, . , , , BlazeDS AMF ( , . DEfusion) .

, Direct Flex to Rails REST, . .

,

+1

RubyAMF, , MVC / AMF.

WebOrb , .

+1

, (WebOrb, RubyAMF, REST) ​​...

WebOrb for Rails , - . , Flex/Ruby, Flex Rails ... , .

RubyAMF , (ha!) WebOrb.

REST, JSON, , (, ), .

YMMV.

+1
0

WebORB RubyAMF, XML-Rails , XML, .

XML, Rails - Flex, . .

To retrieve data from your Rails application, simply create an HTTPService with result_type e4x and call your url. In the rails controller do something like:

def people
  render :xml => Person.all.to_xml
end

Sometimes Rails adds a tag to the end. If this happens, change your controller to:

def people
  render :xml => Person.all.to_xml.target!
end

If you want to send data to your Rails application, it will be just as easy.

<mx:HTTPService id="theservice" url="http://localhost:3000/svc/add_person" method="POST">
 <mx:request>
  <person>
   <first>Firstname</first>
   <last>Lastname</last>
  </person>
 </request>
</HTTPService>

and in your controller:

def add_person
  p=Person.create(params[:person])
  render :xml => {:result => "Success"}.to_xml.target!
end
  • Kevin
0
source

Source: https://habr.com/ru/post/1696939/


All Articles