开发者

AS3: How to send an array of objects in a HTTP query?

开发者 https://www.devze.com 2023-01-28 05:24 出处:网络
I need to send an array of objects from Flex to a Ruby Web service, but sending them as parameters is not getting through since they seen to come through as Objects instead of readable data.

I need to send an array of objects from Flex to a Ruby Web service, but sending them as parameters is not getting through since they seen to come through as Objects instead of readable data.

Sending it as raw XML or JSON didn't work either so the last resort might be to send everything in a HTTP query. However, I'm not sure how to do this since the array contains objects, all of which have 4 or 5 properties, and I don't know what the right format w开发者_JAVA技巧ould be. Help, anyone?


you should look for an AMF implementation of rails AMF - actionscript messaging format.

this way, you pass objects from the server to the client and the other way around, this means that when you send a list to the server, the list is of server object.

for example, if you have a Product object on the server and a Product object on the client you simply send an Arraycollection of Product to the server and iterate with rails

@products.each do |p| 

p will be Product.

there was an implementation of rails here http://blog.rubyamf.org/ although I don't know if it's still maintained.

I also found a good presentation of how to use it here: http://www.slideshare.net/railsconf/integrating-flex-and-rails-with-ruby-amf

0

精彩评论

暂无评论...
验证码 换一张
取 消