WebService XML-RPC session access?

Is there a way to provide access to the session[] from an XML-RPC
server?

I am currently writing an XML-RPC server in Rails, and am using layered
dispatching. Unfortunately, everything works great except session is
always null in the ActionWebService controllers.

Is it possible to get session[] working with layered dispatch in
ActionWebService?

Thanks,
Nate

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