diff options
Diffstat (limited to 'sample/soap')
-rw-r--r-- | sample/soap/calc/httpd.rb | 13 | ||||
-rw-r--r-- | sample/soap/exchange/httpd.rb | 13 | ||||
-rw-r--r-- | sample/soap/sampleStruct/httpd.rb | 13 | ||||
-rw-r--r-- | sample/soap/sampleStruct/server.rb | 6 |
4 files changed, 32 insertions, 13 deletions
diff --git a/sample/soap/calc/httpd.rb b/sample/soap/calc/httpd.rb index ee8ab09f50..bebcff96c6 100644 --- a/sample/soap/calc/httpd.rb +++ b/sample/soap/calc/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/exchange/httpd.rb b/sample/soap/exchange/httpd.rb index ee8ab09f50..bebcff96c6 100644 --- a/sample/soap/exchange/httpd.rb +++ b/sample/soap/exchange/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/sampleStruct/httpd.rb b/sample/soap/sampleStruct/httpd.rb index ee8ab09f50..bebcff96c6 100644 --- a/sample/soap/sampleStruct/httpd.rb +++ b/sample/soap/sampleStruct/httpd.rb @@ -1,14 +1,19 @@ #!/usr/bin/env ruby require 'webrick' -require 'getopts' +require 'soap/property' -getopts "", 'r:', 'p:8808' +docroot = "." +port = 8808 +if opt = SOAP::Property.loadproperty("samplehttpd.conf") + docroot = opt["docroot"] + port = Integer(opt["port"]) +end s = WEBrick::HTTPServer.new( :BindAddress => "0.0.0.0", - :Port => $OPT_p.to_i, - :DocumentRoot => $OPT_r || ".", + :Port => port, + :DocumentRoot => docroot, :CGIPathEnv => ENV['PATH'] ) trap(:INT){ s.shutdown } diff --git a/sample/soap/sampleStruct/server.rb b/sample/soap/sampleStruct/server.rb index 3caa31a052..ea1a2ef1d4 100644 --- a/sample/soap/sampleStruct/server.rb +++ b/sample/soap/sampleStruct/server.rb @@ -12,5 +12,9 @@ class SampleStructServer < SOAP::RPC::StandaloneServer end if $0 == __FILE__ - status = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace, '0.0.0.0', 7000).start + server = SampleStructServer.new('SampleStructServer', SampleStructServiceNamespace, '0.0.0.0', 7000) + trap(:INT) do + server.shutdown + end + server.start end |