aboutsummaryrefslogtreecommitdiffstats
path: root/sample/soap/exchange
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-24 15:18:44 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-24 15:18:44 +0000
commitdb9445103c082a306ba085f7677da02ea94b8841 (patch)
treea311d59f031ae5def87f68be71ed1f58abadc031 /sample/soap/exchange
parent8c2fb77787d1f20b4c19c9c52552856c339b86e9 (diff)
downloadruby-db9445103c082a306ba085f7677da02ea94b8841.tar.gz
* lib/soap/* (29 files): SOAP4R added.
* lib/wsdl/* (42 files): WSDL4R added. * lib/xsd/* (12 files): XSD4R added. * test/soap/* (16 files): added. * test/wsdl/* (2 files): added. * test/xsd/* (3 files): added. * sample/soap/* (27 files): added. * sample/wsdl/* (13 files): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/soap/exchange')
-rw-r--r--sample/soap/exchange/client.rb19
-rw-r--r--sample/soap/exchange/exchange.rb17
-rw-r--r--sample/soap/exchange/httpd.rb15
-rw-r--r--sample/soap/exchange/server.cgi14
-rw-r--r--sample/soap/exchange/server.rb16
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