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

发布于 2024-10-14 05:42:55 字数 1162 浏览 1 评论 0原文

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

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

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

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

更新

相反。 http:async,我尝试使用基于肥皂的网络服务,它工作得很好..如果有人在这里寻找示例,这里是代码..在 rhosync 应用程序的 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)

I am trying to call a web service in rhosync application.rb, I see a 500 error response in rhosync console .. and 'server returned an error' in BB simulator .. :(

Some info about my setup -

I have created a rhodes app that connects to a rhosync app when user enters user name and password and clicks on "login". I am calling this webservice through "authenticate" method of application.rb of the rhosync application ..

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

UPDATE

Instead of http:async, I tried consuming a soap based webservice and it worked just fine .. here is code if anyone cones here in search of a sample.. in application.rb of rhosync app

  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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最美不过初阳 2024-10-21 05:42:55

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

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

然后重试并观察终端输出。请随时将日志发回来,我会看一下。
如果您将 mywebserviceURL 用作变量,您可能还想回显 put mywebserviceURL,我相信您刚刚在此处更改了该帖子。如果用浏览器访问网络服务可以访问吗?

You can typically find the problem if you crank up your log. Edit rhoconfig.txt in your app
set these properties -

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

then try again and watch the terminal output. Feel free to post the log back and I'll take a look.
You also might want to echo out puts the mywebserviceURL if you're using that as a variable, I trust you just changed that for the post here. Can you access the webservice if you hit it with a browser?

愛放△進行李 2024-10-21 05:42:55

需要“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方法中完成的操作及其写入位置。

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)

in this what is done in add_method and authenticate method and where it to be written.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文