aboutsummaryrefslogtreecommitdiffstats
path: root/sample/soap/authheader/server2.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-21 15:08:56 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-21 15:08:56 +0000
commite426b93e84e74ca8e7dbbd12eb86ab1e54681d04 (patch)
tree24f961910f47d6feb0cc10c226fd445624439b1c /sample/soap/authheader/server2.rb
parent8180c1bd50d84563900bfe81dfa45d0ea4c1fa0f (diff)
downloadruby-e426b93e84e74ca8e7dbbd12eb86ab1e54681d04.tar.gz
* lib/soap/*, test/soap/*, sample/soap/authheader/*: eval cleanup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/soap/authheader/server2.rb')
-rw-r--r--sample/soap/authheader/server2.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/sample/soap/authheader/server2.rb b/sample/soap/authheader/server2.rb
index b0065e3140..8a0eaafc8d 100644
--- a/sample/soap/authheader/server2.rb
+++ b/sample/soap/authheader/server2.rb
@@ -6,10 +6,6 @@ require 'authmgr'
class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
class AuthHeaderService
- def self.create
- new
- end
-
def initialize(authmgr)
@authmgr = authmgr
end
@@ -34,14 +30,20 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
Name = 'http://tempuri.org/authHeaderPort'
def initialize(*arg)
super
- add_rpc_servant(AuthHeaderService.new, Name)
- ServerAuthHeaderHandler.init
+ authmgr = Authmgr.new
+ add_rpc_servant(AuthHeaderService.new(authmgr), Name)
+ ServerAuthHeaderHandler.init(authmgr)
+ # header handler must be a per request handler.
add_rpc_request_headerhandler(ServerAuthHeaderHandler)
end
class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler
MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth")
+ def self.init(authmgr)
+ @authmgr = authmgr
+ end
+
def self.create
new(@authmgr)
end
@@ -63,7 +65,7 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
if sessionid = my_header["sessionid"]
if userid = @authmgr.auth(sessionid)
@authmgr.destroy_session(sessionid)
- @session_id = @authmgr.create_session(userid)
+ @sessionid = @authmgr.create_session(userid)
auth = true
end
end
@@ -73,5 +75,9 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer
end
if $0 == __FILE__
- status = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000).start
+ svr = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000)
+ trap(:INT) do
+ svr.shutdown
+ end
+ status = svr.start
end