通过rhosync / rhodes调用webservice时出现500错误

时间:2011-01-27 08:49:53

标签: service rhodes

我正在尝试在rhosync application.rb中调用Web服务,我在rhosync控制台中看到500错误响应..并且'服务器在BB模拟器中返回错误'.. :(

有关我的设置的一些信息 -

我创建了一个rhodes应用程序,当用户输入用户名和密码并点击“登录”时,该应用程序连接到rhosync应用程序。我通过rhosync应用程序的application.rb的“authenticate”方法调用此web服务..

def authenticate(username,password,session)
    Rho::AsyncHttp.get(:url => 'http://mywebserviceURL',:callback => (url_for :action => :httpget_callback),:callback_param => "" )
end

更新

而不是http:async,我尝试使用基于肥皂的web服务,它工作得很好..这里是代码,如果有人在这里搜索样本..在rhosync app的application.rb中

  require "soap/rpc/driver"


        class Application < Rhosync::Base
          class << self
           def authenticate(username,password,session)
              driver = SOAP::RPC::Driver.new('http://webserviceurl')
              driver.add_method('authenticate', 'username', 'password')
              ret=driver.authenticate(username,password)
              if ret=="Success" then
            true
              else
                false
              end
            end
        end

        Application.initializer(ROOT_PATH)

2 个答案:

答案 0 :(得分:0)

如果您启动日志,通常可以找到问题。在您的应用中编辑rhoconfig.txt 设置这些属性 -

# Rhodes runtime properties
MinSeverity  = 1
LogToOutput = 1
LogCategories = *
ExcludeLogCategories =

然后再试一次,观察终端输出。随意发回日志,我会看一看。 如果你将mywebserviceURL用作变量,你也可能想要回显出mywebserviceURL,我相信你刚刚在这里更改了帖子。如果用浏览器点击它,你可以访问网络服务吗?

答案 1 :(得分:0)

需要“soap / rpc / driver”

    class Application < Rhosync::Base
      class << self
       def authenticate(username,password,session)
          driver = SOAP::RPC::Driver.new('http://webserviceurl')
          driver.add_method('authenticate', 'username', 'password')
          ret=driver.authenticate(username,password)
          if ret=="Success" then
        true
          else
            false
          end
        end
    end

    Application.initializer(ROOT_PATH)

在add_method和authenticate方法中执行的操作以及写入的位置。

相关问题