In case anyone else spends a WEEK trying to get XML-RPC sessions
working like I did.
I combined another post in this Google group about HTTP authentication
with my approach. This uses 401 Basic authentication, and returns a
session_id which can be passed as a Cookie in subsequent requests. Not
completely XMLRPC stds-compliant, but works for Rails/Perl/Java.
The missing link was I have to call new(session) in my layered
dispatcher:
class RpcController < ApplicationController
wsdl_service_name ''RPC''
web_service_dispatching_mode :layered
# Must use the {BLOCK} mode of layered dispatch, and explicitly
# pass the session ID into the new() method
web_service(:auth) { AuthService.new(session) }
end
Then, in apis/auth_service.rb:
class AuthService < XmlRpcService
web_service_api AuthAPI
# methods here...
end
And finally, my base XMLRPC ActionWebService class,
apis/xml_rpc_service.rb:
class XmlRpcService < ApplicationController
def initialize(session)
logger.debug "new=#{session}"
@session = session
end
end
I setup all my layered WebService classes to inherit from this.
Just had to find the right combination of black magic...
-Nate
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---