0
我是Rhomobile中的新人,我想用Rhoconnect登錄webservice任何人都可以幫助我如何實現這一點。Rhoconnect webservice登錄需要
我在設置的Controler嘗試:
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(@[email protected]['username'][email protected]['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
但是我沒有什麼.. PLZ給一些想法我。如何解決此問題