diff options
| author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
|---|---|---|
| committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-24 15:18:44 +0000 |
| commit | 7957062899260c10d0a45ab27c9ab3475a4972c3 (patch) | |
| tree | a311d59f031ae5def87f68be71ed1f58abadc031 /sample/soap/sampleStruct | |
| parent | 77a4b63f92cdcf0deb76dc0eeae464a55f5da789 (diff) | |
| download | ruby-7957062899260c10d0a45ab27c9ab3475a4972c3.tar.gz ruby-7957062899260c10d0a45ab27c9ab3475a4972c3.tar.xz ruby-7957062899260c10d0a45ab27c9ab3475a4972c3.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@4591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/soap/sampleStruct')
| -rw-r--r-- | sample/soap/sampleStruct/client.rb | 16 | ||||
| -rw-r--r-- | sample/soap/sampleStruct/httpd.rb | 15 | ||||
| -rw-r--r-- | sample/soap/sampleStruct/iSampleStruct.rb | 22 | ||||
| -rw-r--r-- | sample/soap/sampleStruct/sampleStruct.rb | 13 | ||||
| -rw-r--r-- | sample/soap/sampleStruct/server.cgi | 14 | ||||
| -rw-r--r-- | sample/soap/sampleStruct/server.rb | 16 |
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 000000000..b55c7fdfc --- /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 000000000..ee8ab09f5 --- /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 000000000..399ea52eb --- /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 000000000..394c1bff0 --- /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 000000000..42751386a --- /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 000000000..3caa31a05 --- /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 |
