`
yantoba
  • 浏览: 4425 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

rubuamf安装

阅读更多
以前做Flex,后台不是用.net的FluorineFx,就是用java的bds,总是觉得很不爽,开发起来效率有点低。无意中读到了《Flexible Rails》这本书,让我眼前一亮,原来ror也可以做flex后台,正好可以拾起好久没动的ROR[img]/images/smiles/icon_biggrin.gif" alt="[/img] 。
书中的例子前后台交互使用的HTTPService传输XML,而不是常用的amf网关,让我不禁对效率有一点担忧,还好书中第十一章 Refactoring to RubyAMF,让我又看到了熟悉的amf。Rubyamf,恩,看起来不错,跑起来先玩一玩[img]/images/smiles/icon_lol.gif" alt="[/img] 。

首先介绍一下我的环境,我比较喜欢新事物,所以使用的版本都比较新:
ruby-1.9.1-p243
rails 2.3.3
第一步
ruby script/plugin install http://rubyamf.googlecode.com/svn/trunk/rubyamf
这里注意URL,不是http://rubyamf.googlecode.com/svn/tags/current/rubyamf
第二步
改掉ruby1.9的语法错误,把rubyamf/util/vo_helper.rb,rubyamf/util/action_controller.rb,rubyamf/app/filters.rb中的when ... : ...语法改成when ... then ...
到现在为止,服务可以正常启动。
第三步
undefined method `toutf8' for "flex.messaging.messages.CommandMessage":String
调用服务时报错
解决办法:
rubyamf/io/amf_deserializer.rb
加上require 'kconv'
第四步
The method {xxx} in class {xxx/xxxx/xxxxx_controller.rb} is not declared.
方法未定义
解决方法:
rubyamf/app/actions.rb
100行
if @service.private_methods.include?(@amfbody.service_method_name)
          raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, "The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.")
        elsif !@service.public_methods.include?(@amfbody.service_method_name)
          raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, "The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.")
        end

改为
if @service.private_methods.include?(@amfbody.service_method_name.intern)
          raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, "The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.")
        elsif !@service.public_methods.include?(@amfbody.service_method_name.intern)
          raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, "The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.")
        end


Bingo!

很奇怪,我明明已经写好一遍了,过了十几天再看的时候又没了,只好重写一遍- -
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics