From 7d163a29ec5458eb8e02ef3de8d7aece2be1f59e Mon Sep 17 00:00:00 2001 From: nahi Date: Mon, 20 Dec 2004 13:50:15 +0000 Subject: * added files: * lib/soap/mapping/wsdl*.rb * lib/wsdl/soap/element.rb * lib/wsdl/xmlSchema/simpleContent.rb * modified files: * lib/soap/* * lib/wsdl/* * lib/xsd/* * test/soap/* * test/wsdl/* * test/xsd/* * summary * imported from the soap4r repository. Version: 1.5.3-ruby1.8.2 * added several XSD basetype support: nonPositiveInteger, negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger * HTTP client connection/send/receive timeout support. * HTTP client/server gzipped content encoding support. * improved WSDL schema definition support; still is far from complete, but is making step by step improovement. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/soap/rpc/httpserver.rb | 57 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'lib/soap/rpc/httpserver.rb') diff --git a/lib/soap/rpc/httpserver.rb b/lib/soap/rpc/httpserver.rb index 7b1f961d9..dccf95048 100644 --- a/lib/soap/rpc/httpserver.rb +++ b/lib/soap/rpc/httpserver.rb @@ -55,6 +55,8 @@ class HTTPServer < Logger::Application @soaplet.app_scope_router.mapping_registry = mapping_registry end + # servant entry interface + def add_rpc_request_servant(factory, namespace = @default_namespace, mapping_registry = nil) @soaplet.add_rpc_request_servant(factory, namespace, mapping_registry) @@ -72,23 +74,52 @@ class HTTPServer < Logger::Application @soaplet.add_rpc_headerhandler(obj) end - def add_method(obj, name, *param) - add_method_as(obj, name, name, *param) + # method entry interface + + def add_rpc_method(obj, name, *param) + add_rpc_method_as(obj, name, name, *param) + end + alias add_method add_rpc_method + + def add_document_method(obj, name, req_qname, res_qname) + opt = {} + opt[:request_style] = opt[:response_style] = :document + opt[:request_use] = opt[:response_use] = :literal + param_def = [ + ['input', req_qname.name, [nil, req_qname.namespace, req_qname.name]], + ['output', req_qname.name, [nil, res_qname.namespace, res_qname.name]] + ] + @soaplet.app_scope_router.add_operation(req_qname, nil, obj, name, + param_def, opt) end - def add_method_as(obj, name, name_as, *param) + def add_rpc_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) + param_def = create_param_def(obj, name, param) + add_operation(qname, soapaction, obj, name, param_def) + end + alias add_method_as add_rpc_method_as + + def add_operation(qname, soapaction, obj, name, param_def, opt = {}) + opt[:request_style] ||= :rpc + opt[:response_style] ||= :rpc + opt[:request_use] ||= :encoded + opt[:response_use] ||= :encoded + @soaplet.app_scope_router.add_operation(qname, soapaction, obj, name, + param_def, opt) + end + + def create_param_def(obj, name, param = nil) + if param.nil? or param.empty? + method = obj.method(name) + ::SOAP::RPC::SOAPMethod.create_param_def( + (1..method.arity.abs).collect { |i| "p#{i}" }) + elsif param.size == 1 and param[0].is_a?(Array) + param[0] + else + ::SOAP::RPC::SOAPMethod.create_param_def(param) + end end private -- cgit