diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-03 13:33:20 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-03 13:33:20 +0000 |
commit | df731e37a1953755edfedd1462995fa824ca22bf (patch) | |
tree | 38a98e1b29b3784843ad079fa003790c8f352f58 /lib/soap/rpc | |
parent | 0d6fa996d9e842fe435308cef68df06bc3596a76 (diff) |
* added files:
* lib/soap/header/*
* lib/soap/rpc/httpserver.rb
* lib/wsdl/soap/cgiStubCreator.rb
* lib/wsdl/soap/classDefCreator.rb
* lib/wsdl/soap/classDefCreatorSupport.rb
* lib/wsdl/soap/clientSkeltonCreator.rb
* lib/wsdl/soap/driverCreator.rb
* lib/wsdl/soap/mappingRegistryCreator.rb
* lib/wsdl/soap/methodDefCreator.rb
* lib/wsdl/soap/servantSkeltonCreator.rb
* lib/wsdl/soap/standaloneServerStubCreator.rb
* lib/wsdl/xmlSchema/enumeration.rb
* lib/wsdl/xmlSchema/simpleRestriction.rb
* lib/wsdl/xmlSchema/simpleType.rb
* lib/xsd/codegen/*
* lib/xsd/codegen.rb
* sample/soap/authheader/*
* sample/soap/raa2.4/*
* sample/soap/ssl/*
* sample/soap/swa/*
* sample/soap/whois.rb
* sample/wsdl/raa2.4/*
* test/soap/header/*
* test/soap/ssl/*
* test/soap/struct/*
* test/soap/swa/*
* test/soap/wsdlDriver/*
* test/wsdl/multiplefault.wsdl
* test/wsdl/simpletype/*
* test/wsdl/test_multiplefault.rb
* modified files:
* lib/soap/baseData.rb
* lib/soap/element.rb
* lib/soap/generator.rb
* lib/soap/netHttpClient.rb
* lib/soap/parser.rb
* lib/soap/property.rb
* lib/soap/soap.rb
* lib/soap/streamHandler.rb
* lib/soap/wsdlDriver.rb
* lib/soap/wsdlDriver.rb
* lib/soap/encodingstyle/handler.rb
* lib/soap/encodingstyle/literalHandler.rb
* lib/soap/encodingstyle/soapHandler.rb
* lib/soap/mapping/factory.rb
* lib/soap/mapping/mapping.rb
* lib/soap/mapping/registry.rb
* lib/soap/mapping/rubytypeFactory.rb
* lib/soap/mapping/wsdlRegistry.rb
* lib/soap/rpc/cgistub.rb
* lib/soap/rpc/driver.rb
* lib/soap/rpc/proxy.rb
* lib/soap/rpc/router.rb
* lib/soap/rpc/soaplet.rb
* lib/soap/rpc/standaloneServer.rb
* lib/wsdl/data.rb
* lib/wsdl/definitions.rb
* lib/wsdl/operation.rb
* lib/wsdl/parser.rb
* lib/wsdl/soap/definitions.rb
* lib/wsdl/xmlSchema/complexContent.rb
* lib/wsdl/xmlSchema/complexType.rb
* lib/wsdl/xmlSchema/data.rb
* lib/wsdl/xmlSchema/parser.rb
* lib/wsdl/xmlSchema/schema.rb
* lib/xsd/datatypes.rb
* lib/xsd/qname.rb
* sample/soap/sampleStruct/server.rb
* sample/wsdl/amazon/AmazonSearch.rb
* sample/wsdl/amazon/AmazonSearchDriver.rb
* test/soap/test_property.rb
* test/soap/calc/test_calc_cgi.rb
* test/wsdl/test_emptycomplextype.rb
* summary
* add SOAP Header mustUnderstand support.
* add HTTP client SSL configuration and Cookies support (works
completely with http-access2).
* add header handler for handling sending/receiving SOAP Header.
* map Ruby's anonymous Struct to common SOAP Struct in SOAP Object
Model. it caused error.
* add WSDL simpleType support to restrict lexical value space.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/soap/rpc')
-rw-r--r-- | lib/soap/rpc/cgistub.rb | 12 | ||||
-rw-r--r-- | lib/soap/rpc/driver.rb | 49 | ||||
-rw-r--r-- | lib/soap/rpc/httpserver.rb | 105 | ||||
-rw-r--r-- | lib/soap/rpc/proxy.rb | 6 | ||||
-rw-r--r-- | lib/soap/rpc/router.rb | 32 | ||||
-rw-r--r-- | lib/soap/rpc/soaplet.rb | 102 | ||||
-rw-r--r-- | lib/soap/rpc/standaloneServer.rb | 102 |
7 files changed, 267 insertions, 141 deletions
diff --git a/lib/soap/rpc/cgistub.rb b/lib/soap/rpc/cgistub.rb index 4fc8b98cee..55437bac59 100644 --- a/lib/soap/rpc/cgistub.rb +++ b/lib/soap/rpc/cgistub.rb @@ -1,5 +1,5 @@ # SOAP4R - CGI stub library -# Copyright (C) 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -94,15 +94,21 @@ class CGIStub < Logger::Application on_init end - def add_servant(obj, namespace = @default_namespace, soapaction = nil) + def add_rpc_servant(obj, namespace = @default_namespace, soapaction = nil) RPC.defined_methods(obj).each do |name| qname = XSD::QName.new(namespace, name) param_size = obj.method(name).arity.abs - params = (1..param_size).collect { |i| "p#{ i }" } + params = (1..param_size).collect { |i| "p#{i}" } param_def = SOAP::RPC::SOAPMethod.create_param_def(params) @router.add_method(obj, qname, soapaction, name, param_def) end end + alias add_servant add_rpc_servant + + def add_rpc_headerhandler(obj) + @router.headerhandler << obj + end + alias add_headerhandler add_rpc_headerhandler def on_init # Override this method in derived class to call 'add_method' to add methods. diff --git a/lib/soap/rpc/driver.rb b/lib/soap/rpc/driver.rb index 655174cf33..0e59dde9be 100644 --- a/lib/soap/rpc/driver.rb +++ b/lib/soap/rpc/driver.rb @@ -1,5 +1,5 @@ # SOAP4R - SOAP RPC driver -# Copyright (C) 2000, 2001, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -13,6 +13,7 @@ require 'soap/rpc/proxy' require 'soap/rpc/element' require 'soap/streamHandler' require 'soap/property' +require 'soap/header/handlerset' module SOAP @@ -41,6 +42,8 @@ class Driver end __attr_proxy :options + __attr_proxy :headerhandler + __attr_proxy :test_loopback_response __attr_proxy :endpoint_url, true __attr_proxy :mapping_registry, true __attr_proxy :soapaction, true @@ -84,6 +87,12 @@ class Driver @proxy = @servant.proxy end + def loadproperty(propertyname) + unless options.loadproperty(propertyname) + raise LoadError.new("No such property to load -- #{propertyname}") + end + end + def inspect "#<#{self.class}:#{@servant.streamhandler.inspect}>" end @@ -130,6 +139,7 @@ private class Servant__ attr_reader :options attr_reader :streamhandler + attr_reader :headerhandler attr_reader :proxy def initialize(host, endpoint_url, namespace) @@ -141,6 +151,7 @@ private @options = setup_options @streamhandler = HTTPPostStreamHandler.new(endpoint_url, @options["protocol.http"] ||= ::SOAP::Property.new) + @headerhandler = Header::HandlerSet.new @proxy = Proxy.new(@streamhandler, @soapaction) @proxy.allow_unqualified_element = true end @@ -178,6 +189,10 @@ private @proxy.default_encodingstyle = encodingstyle end + def test_loopback_response + @streamhandler.test_loopback_response + end + def invoke(headers, body) set_wiredump_file_base(body.elename.name) env = @proxy.invoke(headers, body) @@ -192,19 +207,19 @@ private set_wiredump_file_base(name) # Convert parameters: params array => SOAPArray => members array params = Mapping.obj2soap(params, @mapping_registry).to_a - env = @proxy.call(nil, name, *params) + env = @proxy.call(call_headers, name, *params) raise EmptyResponseError.new("Empty response.") unless env - header, body = env.header, env.body + receive_headers(env.header) begin - @proxy.check_fault(body) + @proxy.check_fault(env.body) rescue SOAP::FaultError => e Mapping.fault2exception(e) end - ret = body.response ? - Mapping.soap2obj(body.response, @mapping_registry) : nil - if body.outparams - outparams = body.outparams.collect { |outparam| + ret = env.body.response ? + Mapping.soap2obj(env.body.response, @mapping_registry) : nil + if env.body.outparams + outparams = env.body.outparams.collect { |outparam| Mapping.soap2obj(outparam) } return [ret].concat(outparams) @@ -233,10 +248,28 @@ private @servant.call(#{ name.dump }#{ callparam }) end EOS + @host.method(name) end private + def call_headers + headers = @headerhandler.on_outbound + if headers.empty? + nil + else + h = ::SOAP::SOAPHeader.new + headers.each do |header| + h.add(header.elename.name, header) + end + h + end + end + + def receive_headers(headers) + @headerhandler.on_inbound(headers) if headers + end + def set_wiredump_file_base(name) if @wiredump_file_base @streamhandler.wiredump_file_base = @wiredump_file_base + "_#{ name }" diff --git a/lib/soap/rpc/httpserver.rb b/lib/soap/rpc/httpserver.rb new file mode 100644 index 0000000000..7b1f961d9e --- /dev/null +++ b/lib/soap/rpc/httpserver.rb @@ -0,0 +1,105 @@ +# SOAP4R - WEBrick HTTP Server +# Copyright (C) 2003, 2004 by NAKAMURA, Hiroshi <nahi@ruby-lang.org>. + +# This program is copyrighted free software by NAKAMURA, Hiroshi. You can +# redistribute it and/or modify it under the same terms of Ruby's license; +# either the dual license version in 2003, or any later version. + + +require 'logger' +require 'soap/rpc/soaplet' +require 'soap/streamHandler' +require 'webrick' + + +module SOAP +module RPC + + +class HTTPServer < Logger::Application + attr_reader :server + attr_accessor :default_namespace + + def initialize(config) + super(config[:SOAPHTTPServerApplicationName] || self.class.name) + @default_namespace = config[:SOAPDefaultNamespace] + @webrick_config = config.dup + @webrick_config[:Logger] ||= @log + @server = nil + @soaplet = ::SOAP::RPC::SOAPlet.new + self.level = Logger::Severity::INFO + on_init + end + + def on_init + # define extra methods in derived class. + end + + def status + if @server + @server.status + else + nil + end + end + + def shutdown + @server.shutdown if @server + end + + def mapping_registry + @soaplet.app_scope_router.mapping_registry + end + + def mapping_registry=(mapping_registry) + @soaplet.app_scope_router.mapping_registry = mapping_registry + end + + def add_rpc_request_servant(factory, namespace = @default_namespace, + mapping_registry = nil) + @soaplet.add_rpc_request_servant(factory, namespace, mapping_registry) + end + + def add_rpc_servant(obj, namespace = @default_namespace) + @soaplet.add_rpc_servant(obj, namespace) + end + + def add_rpc_request_headerhandler(factory) + @soaplet.add_rpc_request_headerhandler(factory) + end + + def add_rpc_headerhandler(obj) + @soaplet.add_rpc_headerhandler(obj) + end + + def add_method(obj, name, *param) + add_method_as(obj, name, name, *param) + end + + def add_method_as(obj, name, name_as, *param) + qname = XSD::QName.new(@default_namespace, name_as) + soapaction = nil + method = obj.method(name) + param_def = if param.size == 1 and param[0].is_a?(Array) + param[0] + elsif param.empty? + ::SOAP::RPC::SOAPMethod.create_param_def( + (1..method.arity.abs).collect { |i| "p#{ i }" }) + else + SOAP::RPC::SOAPMethod.create_param_def(param) + end + @soaplet.app_scope_router.add_method(obj, qname, soapaction, name, param_def) + end + +private + + def run + @server = WEBrick::HTTPServer.new(@webrick_config) + @server.mount('/', @soaplet) + @server.start + end +end + + +end +end diff --git a/lib/soap/rpc/proxy.rb b/lib/soap/rpc/proxy.rb index 7d9dbe519e..355bf2e81a 100644 --- a/lib/soap/rpc/proxy.rb +++ b/lib/soap/rpc/proxy.rb @@ -1,5 +1,5 @@ # SOAP4R - RPC Proxy library. -# Copyright (C) 2000, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2000, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -112,9 +112,9 @@ public unmarshal(conn_data, opt) end - def call(headers, name, *values) + def call(req_header, name, *values) req = create_request(name, *values) - invoke(headers, req.method, req.method.soapaction || @soapaction) + invoke(req_header, req.method, req.method.soapaction || @soapaction) end def check_fault(body) diff --git a/lib/soap/rpc/router.rb b/lib/soap/rpc/router.rb index 12622c72b1..9d8d1c8da6 100644 --- a/lib/soap/rpc/router.rb +++ b/lib/soap/rpc/router.rb @@ -13,6 +13,7 @@ require 'soap/rpc/rpc' require 'soap/rpc/element' require 'soap/streamHandler' require 'soap/mimemessage' +require 'soap/header/handlerset' module SOAP @@ -26,6 +27,7 @@ class Router attr_accessor :allow_unqualified_element attr_accessor :default_encodingstyle attr_accessor :mapping_registry + attr_reader :headerhandler def initialize(actor) @actor = actor @@ -35,6 +37,7 @@ class Router @allow_unqualified_element = false @default_encodingstyle = nil @mapping_registry = nil + @headerhandler = Header::HandlerSet.new end def add_method(receiver, qname, soapaction, name, param_def) @@ -44,12 +47,6 @@ class Router @method[fqname] = RPC::SOAPMethodRequest.new(qname, param_def, soapaction) end - def add_header_handler - raise NotImplementedError.new - end - - # Routing... - #def route(soap_string, charset = nil) def route(conn_data) soap_response = nil begin @@ -57,7 +54,7 @@ class Router if env.nil? raise ArgumentError.new("Illegal SOAP marshal format.") end - # So far, header is omitted... + receive_headers(env.header) soap_request = env.body.request unless soap_request.is_a?(SOAPStruct) raise RPCRoutingError.new("Not an RPC style.") @@ -70,7 +67,7 @@ class Router opt = options opt[:external_content] = nil - header = SOAPHeader.new + header = call_headers body = SOAPBody.new(soap_response) env = SOAPEnvelope.new(header, body) response_string = Processor.marshal(env, opt) @@ -114,13 +111,30 @@ class Router private + def call_headers + headers = @headerhandler.on_outbound + if headers.empty? + nil + else + h = ::SOAP::SOAPHeader.new + headers.each do |header| + h.add(header.elename.name, header) + end + h + end + end + + def receive_headers(headers) + @headerhandler.on_inbound(headers) if headers + end + def unmarshal(conn_data) opt = options contenttype = conn_data.receive_contenttype if /#{MIMEMessage::MultipartContentType}/i =~ contenttype opt[:external_content] = {} mime = MIMEMessage.parse("Content-Type: " + contenttype, - conn_data.receive_string) + conn_data.receive_string) mime.parts.each do |part| value = Attachment.new(part.content) value.contentid = part.contentid diff --git a/lib/soap/rpc/soaplet.rb b/lib/soap/rpc/soaplet.rb index 7cb5e32375..0c1427acf5 100644 --- a/lib/soap/rpc/soaplet.rb +++ b/lib/soap/rpc/soaplet.rb @@ -1,5 +1,5 @@ # SOAP4R - SOAP handler servlet for WEBrick -# Copyright (C) 2001, 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2001, 2002, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -22,20 +22,28 @@ public def initialize @router_map = {} @app_scope_router = ::SOAP::RPC::Router.new(self.class.name) + @headerhandlerfactory = [] + @app_scope_headerhandler = nil end - # Add servant klass whose object has request scope. A servant object is - # instantiated for each request. + # Add servant factory whose object has request scope. A servant object is + # instanciated for each request. # - # Bare in mind that servant klasses are distinguished by HTTP SOAPAction + # Bear in mind that servant factories are distinguished by HTTP SOAPAction # header in request. Client which calls request-scoped servant must have a - # SOAPAction header which is a namespace of the servant klass. + # SOAPAction header which is a namespace of the servant factory. # I mean, use Driver#add_method_with_soapaction instead of Driver#add_method # at client side. # - def add_rpc_request_servant(klass, namespace, mapping_registry = nil) - router = RequestRouter.new(klass, namespace, mapping_registry) - add_router(namespace, router) + # A factory must respond to :create. + # + def add_rpc_request_servant(factory, namespace, mapping_registry = nil) + unless factory.respond_to?(:create) + raise TypeError.new("factory must respond to 'create'") + end + router = setup_request_router(namespace) + router.factory = factory + router.mapping_registry = mapping_registry end # Add servant object which has application scope. @@ -46,6 +54,17 @@ public end alias add_servant add_rpc_servant + def add_rpc_request_headerhandler(factory) + unless factory.respond_to?(:create) + raise TypeError.new("factory must respond to 'create'") + end + @headerhandlerfactory << factory + end + + def add_rpc_headerhandler(obj) + @app_scope_headerhandler = obj + end + alias add_headerhandler add_rpc_headerhandler ### ## Servlet interfaces for WEBrick. @@ -67,21 +86,23 @@ public def do_POST(req, res) namespace = parse_soapaction(req.meta_vars['HTTP_SOAPACTION']) router = lookup_router(namespace) - begin - conn_data = ::SOAP::StreamHandler::ConnectionData.new - conn_data.receive_string = req.body - conn_data.receive_contenttype = req['content-type'] - conn_data = router.route(conn_data) - if conn_data.is_fault + with_headerhandler(router) do |router| + begin + conn_data = ::SOAP::StreamHandler::ConnectionData.new + conn_data.receive_string = req.body + conn_data.receive_contenttype = req['content-type'] + conn_data = router.route(conn_data) + if conn_data.is_fault + res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR + end + res.body = conn_data.send_string + res['content-type'] = conn_data.send_contenttype + rescue Exception => e + conn_data = router.create_fault_response(e) res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR + res.body = conn_data.send_string + res['content-type'] = conn_data.send_contenttype || "text/xml" end - res.body = conn_data.send_string - res['content-type'] = conn_data.send_contenttype - rescue Exception => e - conn_data = router.create_fault_response(e) - res.status = WEBrick::HTTPStatus::RC_INTERNAL_SERVER_ERROR - res.body = conn_data.send_string - res['content-type'] = conn_data.send_contenttype || "text/xml" end if res.body.is_a?(IO) @@ -92,17 +113,16 @@ public private class RequestRouter < ::SOAP::RPC::Router - def initialize(klass, namespace, mapping_registry = nil) + attr_accessor :factory + + def initialize(namespace = nil) super(namespace) - if mapping_registry - self.mapping_registry = mapping_registry - end - @klass = klass @namespace = namespace + @factory = nil end def route(soap_string) - obj = @klass.new + obj = @factory.create namespace = self.actor router = ::SOAP::RPC::Router.new(@namespace) SOAPlet.add_servant_to_router(router, obj, namespace) @@ -110,6 +130,12 @@ private end end + def setup_request_router(namespace) + router = @router_map[namespace] || RequestRouter.new(namespace) + add_router(namespace, router) + router + end + def add_router(namespace, router) @router_map[namespace] = router end @@ -132,11 +158,29 @@ private end end + def with_headerhandler(router) + if @app_scope_headerhandler and + !router.headerhandler.include?(@app_scope_headerhandler) + router.headerhandler.add(@app_scope_headerhandler) + end + handlers = @headerhandlerfactory.collect { |f| f.create } + begin + handlers.each { |h| router.headerhandler.add(h) } + yield(router) + ensure + handlers.each { |h| router.headerhandler.delete(h) } + end + end + class << self public def add_servant_to_router(router, obj, namespace) ::SOAP::RPC.defined_methods(obj).each do |name| - add_servant_method_to_router(router, obj, namespace, name) + begin + add_servant_method_to_router(router, obj, namespace, name) + rescue SOAP::RPC::MethodDefinitionError => e + p e if $DEBUG + end end end @@ -145,7 +189,7 @@ private soapaction = nil method = obj.method(name) param_def = ::SOAP::RPC::SOAPMethod.create_param_def( - (1..method.arity.abs).collect { |i| "p#{ i }" }) + (1..method.arity.abs).collect { |i| "p#{ i }" }) router.add_method(obj, qname, soapaction, name, param_def) end end diff --git a/lib/soap/rpc/standaloneServer.rb b/lib/soap/rpc/standaloneServer.rb index 42a566e088..080343ba33 100644 --- a/lib/soap/rpc/standaloneServer.rb +++ b/lib/soap/rpc/standaloneServer.rb @@ -6,111 +6,35 @@ # either the dual license version in 2003, or any later version. -require 'logger' -require 'soap/rpc/soaplet' -require 'soap/streamHandler' - -# require 'webrick' -require 'webrick/compat.rb' -require 'webrick/version.rb' -require 'webrick/config.rb' -require 'webrick/log.rb' -require 'webrick/server.rb' -require 'webrick/utils.rb' -require 'webrick/accesslog' -# require 'webrick/htmlutils.rb' -require 'webrick/httputils.rb' -# require 'webrick/cookie.rb' -require 'webrick/httpversion.rb' -require 'webrick/httpstatus.rb' -require 'webrick/httprequest.rb' -require 'webrick/httpresponse.rb' -require 'webrick/httpserver.rb' -# require 'webrick/httpservlet.rb' -# require 'webrick/httpauth.rb' +require 'soap/rpc/httpserver' module SOAP module RPC -class StandaloneServer < Logger::Application - attr_reader :server - - def initialize(app_name, namespace, host = "0.0.0.0", port = 8080) - super(app_name) - self.level = Logger::Severity::INFO - @namespace = namespace +class StandaloneServer < HTTPServer + def initialize(appname, default_namespace, host = "0.0.0.0", port = 8080) + @appname = appname + @default_namespace = default_namespace @host = host @port = port - @server = nil - @soaplet = ::SOAP::RPC::SOAPlet.new - on_init - end - - def on_init - # define extra methods in derived class. - end - - def status - if @server - @server.status - else - nil - end - end - - def shutdown - @server.shutdown - end - - def add_rpc_request_servant(klass, namespace = @namespace, mapping_registry = nil) - @soaplet.add_rpc_request_servant(klass, namespace, mapping_registry) + super(create_config) end - def add_rpc_servant(obj, namespace = @namespace) - @soaplet.add_rpc_servant(obj, namespace) - end alias add_servant add_rpc_servant - - def mapping_registry - @soaplet.app_scope_router.mapping_registry - end - - def mapping_registry=(mapping_registry) - @soaplet.app_scope_router.mapping_registry = mapping_registry - end - - def add_method(obj, name, *param) - add_method_as(obj, name, name, *param) - end - - def add_method_as(obj, name, name_as, *param) - qname = XSD::QName.new(@namespace, name_as) - soapaction = nil - method = obj.method(name) - param_def = if param.size == 1 and param[0].is_a?(Array) - param[0] - elsif param.empty? - ::SOAP::RPC::SOAPMethod.create_param_def( - (1..method.arity.abs).collect { |i| "p#{ i }" }) - else - SOAP::RPC::SOAPMethod.create_param_def(param) - end - @soaplet.app_scope_router.add_method(obj, qname, soapaction, name, param_def) - end + alias add_headerhandler add_rpc_headerhandler private - def run - @server = WEBrick::HTTPServer.new( + def create_config + { :BindAddress => @host, - :Logger => @log, + :Port => @port, :AccessLog => [], - :Port => @port - ) - @server.mount('/', @soaplet) - @server.start + :SOAPDefaultNamespace => @default_namespace, + :SOAPHTTPServerApplicationName => @appname, + } end end |