diff options
Diffstat (limited to 'sample/soap/exchange')
-rw-r--r-- | sample/soap/exchange/client.rb | 19 | ||||
-rw-r--r-- | sample/soap/exchange/exchange.rb | 17 | ||||
-rw-r--r-- | sample/soap/exchange/httpd.rb | 15 | ||||
-rw-r--r-- | sample/soap/exchange/server.cgi | 14 | ||||
-rw-r--r-- | sample/soap/exchange/server.rb | 16 |
5 files changed, 81 insertions, 0 deletions
diff --git a/sample/soap/exchange/client.rb b/sample/soap/exchange/client.rb new file mode 100644 index 0000000000..2aa277afef --- /dev/null +++ b/sample/soap/exchange/client.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +require "soap/rpc/driver" + +ExchangeServiceNamespace = 'http://tempuri.org/exchangeService' + +server = ARGV.shift || "http://localhost:7000/" +# server = "http://localhost:8808/server.cgi" + +logger = nil +wiredump_dev = nil +# logger = Logger.new(STDERR) +# wiredump_dev = STDERR + +drv = SOAP::RPC::Driver.new(server, ExchangeServiceNamespace) +drv.wiredump_dev = wiredump_dev +drv.add_method("rate", "country1", "country2") + +p drv.rate("USA", "Japan") diff --git a/sample/soap/exchange/exchange.rb b/sample/soap/exchange/exchange.rb new file mode 100644 index 0000000000..00f930deb8 --- /dev/null +++ b/sample/soap/exchange/exchange.rb @@ -0,0 +1,17 @@ +require 'soap/rpc/driver' + +ExchangeServiceNamespace = 'http://tempuri.org/exchangeService' + +class Exchange + ForeignServer = "http://services.xmethods.net/soap" + Namespace = "urn:xmethods-CurrencyExchange" + + def initialize + @drv = SOAP::RPC::Driver.new(ForeignServer, Namespace) + @drv.add_method("getRate", "country1", "country2") + end + + def rate(country1, country2) + return @drv.getRate(country1, country2) + end +end diff --git a/sample/soap/exchange/httpd.rb b/sample/soap/exchange/httpd.rb new file mode 100644 index 0000000000..ee8ab09f50 --- /dev/null +++ b/sample/soap/exchange/httpd.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +require 'webrick' +require 'getopts' + +getopts "", 'r:', 'p:8808' + +s = WEBrick::HTTPServer.new( + :BindAddress => "0.0.0.0", + :Port => $OPT_p.to_i, + :DocumentRoot => $OPT_r || ".", + :CGIPathEnv => ENV['PATH'] +) +trap(:INT){ s.shutdown } +s.start diff --git a/sample/soap/exchange/server.cgi b/sample/soap/exchange/server.cgi new file mode 100644 index 0000000000..16bc85a042 --- /dev/null +++ b/sample/soap/exchange/server.cgi @@ -0,0 +1,14 @@ +#!/usr/local/bin/ruby + +require 'soap/rpc/cgistub' +require 'exchange' + +class ExchangeServer < SOAP::RPC::CGIStub + def initialize(*arg) + super + servant = Exchange.new + add_servant(servant) + end +end + +status = ExchangeServer.new('SampleStructServer', ExchangeServiceNamespace).start diff --git a/sample/soap/exchange/server.rb b/sample/soap/exchange/server.rb new file mode 100644 index 0000000000..d510d54a76 --- /dev/null +++ b/sample/soap/exchange/server.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + +require 'soap/rpc/standaloneServer' +require 'exchange' + +class ExchangeServer < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + servant = Exchange.new + add_servant(servant) + end +end + +if $0 == __FILE__ + status = ExchangeServer.new('SampleStructServer', ExchangeServiceNamespace, '0.0.0.0', 7000).start +end |