summaryrefslogtreecommitdiffstats
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
commite6b62964d5ce1508d867bec513cc76a0e4bd026b (patch)
treeec583bf4781cefd0a19735386b456046b8993d70 /sample/soap/authheader/server2.rb
parentd2faf61018b834efdcba69db8cd6703661247513 (diff)
downloadruby-e6b62964d5ce1508d867bec513cc76a0e4bd026b.tar.gz
ruby-e6b62964d5ce1508d867bec513cc76a0e4bd026b.tar.xz
ruby-e6b62964d5ce1508d867bec513cc76a0e4bd026b.zip
* lib/soap/*, test/soap/*, sample/soap/authheader/*: eval cleanup.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@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 b0065e314..8a0eaafc8 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