我是 Rhomobile 的新手,我想使用 Rhoconnect 登录网络服务,任何人都可以帮助我如何实现这一点。
我在设置控制器中尝试过:
def do_login
if @params['username'] and @params['password']
begin
SyncEngine.login(@params['username'], @params['password'], (url_for :action => :login_callback) )
@response['headers']['Wait-Page'] = 'true'
redirect :action => :index
rescue Rho::RhoError => e
@msg = e.message
render :action => :login
end
else
@msg = Rho::RhoError.err_message(Rho::RhoError::ERR_UNATHORIZED) unless @msg && @msg.length > 0
render :action => :login
end
end
在哪里SyncEngine.login(@params['username'], @params['password'])
调用 sourecadapter 方法login
;我在哪里打电话
def login(username, password)
user_info = {:username => username, :password => password }
response = RestClient.get(@base+@params['username']+@params['password'])
result = RestClient.post(:url => "my-webservice" )
@msg=result["body"]
render :action => :index
end
我试过了:
class Application < Rhoconnect::Base
class << self
def authenticate(username,password,session)
result = RestClient.post(:url => "mywebservice" )
true # do some interesting authentication here...
end
end
但我什么都没有……请给我一些想法;如何解决这个问题