summaryrefslogtreecommitdiff
path: root/sample/soap/sampleStruct
diff options
context:
space:
mode:
Diffstat (limited to 'sample/soap/sampleStruct')
-rw-r--r--sample/soap/sampleStruct/client.rb16
-rw-r--r--sample/soap/sampleStruct/httpd.rb15
-rw-r--r--sample/soap/sampleStruct/iSampleStruct.rb22
-rw-r--r--sample/soap/sampleStruct/sampleStruct.rb13
-rw-r--r--sample/soap/sampleStruct/server.cgi14
-rw-r--r--sample/soap/sampleStruct/server.rb16
6 files changed, 96 insertions, 0 deletions
diff --git a/sample/soap/sampleStruct/client.rb b/sample/soap/sampleStruct/client.rb
new file mode 100644
index 0000000000..b55c7fdfc5
--- /dev/null
+++ b/sample/soap/sampleStruct/client.rb
@@ -0,0 +1,16 @@
+require 'soap/rpc/driver'
+
+require 'iSampleStruct'
+
+server = ARGV.shift || 'http://localhost:7000/'
+# server = 'http://localhost:8808/server.cgi'
+
+drv = SOAP::RPC::Driver.new(server, SampleStructServiceNamespace)
+drv.wiredump_dev = STDERR
+drv.add_method('hi', 'sampleStruct')
+
+o1 = SampleStruct.new
+puts "Sending struct: #{ o1.inspect }"
+puts
+o2 = drv.hi(o1)
+puts "Received (wrapped): #{ o2.inspect }"
diff --git a/sample/soap/sampleStruct/httpd.rb b/sample/soap/sampleStruct/httpd.rb
new file mode 100644
index 0000000000..ee8ab09f50
--- /dev/null
+++ b/sample/soap/sampleStruct/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/sampleStruct/iSampleStruct.rb b/sample/soap/sampleStruct/iSampleStruct.rb
new file mode 100644
index 0000000000..399ea52eb8
--- /dev/null
+++ b/sample/soap/sampleStruct/iSampleStruct.rb
@@ -0,0 +1,22 @@
+require 'soap/mapping'
+
+SampleStructServiceNamespace = 'http://tempuri.org/sampleStructService'
+
+class SampleStruct; include SOAP::Marshallable
+ attr_accessor :sampleArray
+ attr_accessor :date
+
+ def initialize
+ @sampleArray = SampleArray[ "cyclic", self ]
+ @date = DateTime.now
+ end
+
+ def wrap( rhs )
+ @sampleArray = SampleArray[ "wrap", rhs.dup ]
+ @date = DateTime.now
+ self
+ end
+end
+
+class SampleArray < Array; include SOAP::Marshallable
+end
diff --git a/sample/soap/sampleStruct/sampleStruct.rb b/sample/soap/sampleStruct/sampleStruct.rb
new file mode 100644
index 0000000000..394c1bff09
--- /dev/null
+++ b/sample/soap/sampleStruct/sampleStruct.rb
@@ -0,0 +1,13 @@
+require 'iSampleStruct'
+
+class SampleStructService
+ def hi(struct)
+ ack = SampleStruct.new
+ ack.wrap(struct)
+ ack
+ end
+end
+
+if __FILE__ == $0
+ p SampleStructService.new.hi(SampleStruct.new)
+end
diff --git a/sample/soap/sampleStruct/server.cgi b/sample/soap/sampleStruct/server.cgi
new file mode 100644
index 0000000000..42751386a0
--- /dev/null
+++ b/sample/soap/sampleStruct/server.cgi
@@ -0,0 +1,14 @@
+#!/usr/local/bin/ruby
+
+require 'soap/rpc/cgistub'
+require 'sampleStruct'
+
+class SampleStructServer < SOAP::RPC::CGIStub
+ def initialize(*arg)
+ super
+ servant = SampleStructService.new
+ add_servant(servant)
+ end
+end
+
+status = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace).start
diff --git a/sample/soap/sampleStruct/server.rb b/sample/soap/sampleStruct/server.rb
new file mode 100644
index 0000000000..3caa31a052
--- /dev/null
+++ b/sample/soap/sampleStruct/server.rb
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+require 'soap/rpc/standaloneServer'
+require 'sampleStruct'
+
+class SampleStructServer < SOAP::RPC::StandaloneServer
+ def initialize(*arg)
+ super
+ servant = SampleStructService.new
+ add_servant(servant)
+ end
+end
+
+if $0 == __FILE__
+ status = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace, '0.0.0.0', 7000).start
+end