rhosync application.rbでWebサービスを呼び出そうとしていますが、rhosyncコンソールで500エラー応答が表示され、BBシミュレーターで「サーバーがエラーを返しました」.. :(
私のセットアップに関するいくつかの情報-
ユーザーがユーザー名とパスワードを入力して「ログイン」をクリックすると、rhosyncアプリに接続するrhodesアプリを作成しました。rhosyncアプリケーションのapplication.rbの「認証」メソッドを介してこのWebサービスを呼び出しています。
def authenticate(username,password,session)
Rho::AsyncHttp.get(:url => 'http://mywebserviceURL',:callback => (url_for :action => :httpget_callback),:callback_param => "" )
end
アップデート
http:asyncの代わりに、SOAPベースのWebサービスを使用してみましたが、問題なく機能しました。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)