diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-03 15:38:36 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-03 15:38:36 +0000 |
commit | 5548c7bff292de16abb9f6e8d9cc4999e0b22c71 (patch) | |
tree | ce6b571d063d031d1b5cba3ba7671ca138405a3a /sample/soap/authheader/client2.rb | |
parent | ab31bf0d4d44942e46d98d8848b788ac6df32a46 (diff) |
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/soap/authheader/client2.rb')
-rw-r--r-- | sample/soap/authheader/client2.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sample/soap/authheader/client2.rb b/sample/soap/authheader/client2.rb new file mode 100644 index 0000000000..58a7da45ae --- /dev/null +++ b/sample/soap/authheader/client2.rb @@ -0,0 +1,39 @@ +require 'soap/rpc/driver' +require 'soap/header/simplehandler' + +server = ARGV.shift || 'http://localhost:7000/' + +class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler + MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth") + + def initialize(userid, passwd) + super(MyHeaderName) + @sessionid = nil + @userid = userid + @passwd = passwd + end + + def on_simple_outbound + if @sessionid + { "sessionid" => @sessionid } + else + { "userid" => @userid, "passwd" => @passwd } + end + end + + def on_simple_inbound(my_header, mustunderstand) + @sessionid = my_header["sessionid"] + end +end + +ns = 'http://tempuri.org/authHeaderPort' +serv = SOAP::RPC::Driver.new(server, ns) +serv.add_method('deposit', 'amt') +serv.add_method('withdrawal', 'amt') + +serv.headerhandler << ClientAuthHeaderHandler.new('NaHi', 'passwd') + +serv.wiredump_dev = STDOUT + +p serv.deposit(150) +p serv.withdrawal(120) |