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
source
share