diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 13:50:15 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 13:50:15 +0000 |
commit | e5a3aba50e2bd7e0327aacd8fe1ab7963fc4a007 (patch) | |
tree | b56a6e784df74331c28e4a94901b96837f214e35 /lib/wsdl/soap | |
parent | 643dc132113489749c333a6bda14730d9b175ed1 (diff) | |
download | ruby-e5a3aba50e2bd7e0327aacd8fe1ab7963fc4a007.tar.gz |
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@7612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/wsdl/soap')
-rw-r--r-- | lib/wsdl/soap/address.rb | 2 | ||||
-rw-r--r-- | lib/wsdl/soap/binding.rb | 9 | ||||
-rw-r--r-- | lib/wsdl/soap/body.rb | 8 | ||||
-rw-r--r-- | lib/wsdl/soap/cgiStubCreator.rb | 9 | ||||
-rw-r--r-- | lib/wsdl/soap/classDefCreator.rb | 156 | ||||
-rw-r--r-- | lib/wsdl/soap/classDefCreatorSupport.rb | 22 | ||||
-rw-r--r-- | lib/wsdl/soap/clientSkeltonCreator.rb | 2 | ||||
-rw-r--r-- | lib/wsdl/soap/complexType.rb | 40 | ||||
-rw-r--r-- | lib/wsdl/soap/data.rb | 1 | ||||
-rw-r--r-- | lib/wsdl/soap/driverCreator.rb | 11 | ||||
-rw-r--r-- | lib/wsdl/soap/element.rb | 34 | ||||
-rw-r--r-- | lib/wsdl/soap/fault.rb | 8 | ||||
-rw-r--r-- | lib/wsdl/soap/header.rb | 10 | ||||
-rw-r--r-- | lib/wsdl/soap/headerfault.rb | 8 | ||||
-rw-r--r-- | lib/wsdl/soap/methodDefCreator.rb | 55 | ||||
-rw-r--r-- | lib/wsdl/soap/operation.rb | 9 | ||||
-rw-r--r-- | lib/wsdl/soap/servantSkeltonCreator.rb | 16 | ||||
-rw-r--r-- | lib/wsdl/soap/standaloneServerStubCreator.rb | 16 |
18 files changed, 308 insertions, 108 deletions
diff --git a/lib/wsdl/soap/address.rb b/lib/wsdl/soap/address.rb index e4558e4ff8..0b2b59caf0 100644 --- a/lib/wsdl/soap/address.rb +++ b/lib/wsdl/soap/address.rb @@ -28,7 +28,7 @@ class Address < Info def parse_attr(attr, value) case attr when LocationAttrName - @location = value + @location = value.source else nil end diff --git a/lib/wsdl/soap/binding.rb b/lib/wsdl/soap/binding.rb index 1cfe9b9cc4..7e15a99701 100644 --- a/lib/wsdl/soap/binding.rb +++ b/lib/wsdl/soap/binding.rb @@ -30,13 +30,14 @@ class Binding < Info def parse_attr(attr, value) case attr when StyleAttrName - if ["document", "rpc"].include?(value) - @style = value.intern + if ["document", "rpc"].include?(value.source) + @style = value.source.intern else - raise AttributeConstraintError.new("Unexpected value #{ value }.") + raise Parser::AttributeConstraintError.new( + "Unexpected value #{ value }.") end when TransportAttrName - @transport = value + @transport = value.source else nil end diff --git a/lib/wsdl/soap/body.rb b/lib/wsdl/soap/body.rb index 47de6b1e1a..47e99f381b 100644 --- a/lib/wsdl/soap/body.rb +++ b/lib/wsdl/soap/body.rb @@ -34,13 +34,13 @@ class Body < Info def parse_attr(attr, value) case attr when PartsAttrName - @parts = value + @parts = value.source when UseAttrName - @use = value + @use = value.source when EncodingStyleAttrName - @encodingstyle = value + @encodingstyle = value.source when NamespaceAttrName - @namespace = value + @namespace = value.source else nil end diff --git a/lib/wsdl/soap/cgiStubCreator.rb b/lib/wsdl/soap/cgiStubCreator.rb index e5b64336e7..68ecfaf0a4 100644 --- a/lib/wsdl/soap/cgiStubCreator.rb +++ b/lib/wsdl/soap/cgiStubCreator.rb @@ -55,8 +55,13 @@ Methods = [ <<-EOD super(*arg) servant = #{class_name}.new - #{class_name}::Methods.each do |name_as, name, params, soapaction, ns| - add_method_with_namespace_as(ns, servant, name, name_as, params, soapaction) + #{class_name}::Methods.each do |name_as, name, param_def, soapaction, namespace, style| + qname = XSD::QName.new(namespace, name_as) + if style == :document + @router.add_document_method(servant, qname, soapaction, name, param_def) + else + @router.add_rpc_method(servant, qname, soapaction, name, param_def) + end end self.mapping_registry = #{class_name}::MappingRegistry self.level = Logger::Severity::ERROR diff --git a/lib/wsdl/soap/classDefCreator.rb b/lib/wsdl/soap/classDefCreator.rb index 6c7d381932..13f7802b72 100644 --- a/lib/wsdl/soap/classDefCreator.rb +++ b/lib/wsdl/soap/classDefCreator.rb @@ -19,42 +19,71 @@ class ClassDefCreator include ClassDefCreatorSupport def initialize(definitions) + @elements = definitions.collect_elements @simpletypes = definitions.collect_simpletypes @complextypes = definitions.collect_complextypes - @faulttypes = definitions.collect_faulttypes + @faulttypes = definitions.collect_faulttypes if definitions.respond_to?(:collect_faulttypes) end def dump(class_name = nil) - result = "" + result = '' if class_name result = dump_classdef(class_name) else - @complextypes.each do |type| - case type.compoundtype - when :TYPE_STRUCT - result << dump_classdef(type) - when :TYPE_ARRAY - result << dump_arraydef(type) - else - raise RuntimeError.new("Unknown complexContent definition...") - end - result << "\n" + str = dump_element + unless str.empty? + result << "\n" unless result.empty? + result << str + end + str = dump_complextype + unless str.empty? + result << "\n" unless result.empty? + result << str + end + str = dump_simpletype + unless str.empty? + result << "\n" unless result.empty? + result << str end - - result << @simpletypes.collect { |type| - dump_simpletypedef(type) - }.join("\n") end result end private + def dump_element + @elements.collect { |ele| + ele.local_complextype ? dump_classdef(ele) : '' + }.join("\n") + end + + def dump_simpletype + @simpletypes.collect { |type| + dump_simpletypedef(type) + }.join("\n") + end + + def dump_complextype + @complextypes.collect { |type| + case type.compoundtype + when :TYPE_STRUCT + dump_classdef(type) + when :TYPE_ARRAY + dump_arraydef(type) + when :TYPE_SIMPLE + STDERR.puts("not implemented: ToDo") + else + raise RuntimeError.new( + "Unknown kind of complexContent: #{type.compoundtype}") + end + }.join("\n") + end + def dump_simpletypedef(simpletype) qname = simpletype.name if simpletype.restriction.enumeration.empty? STDERR.puts("#{qname}: simpleType which is not enum type not supported.") - return "" + return '' end c = XSD::CodeGen::ModuleDef.new(create_class_name(qname)) c.comment = "#{ qname.namespace }" @@ -64,45 +93,98 @@ private c.dump end - def dump_classdef(complextype) - qname = complextype.name - if @faulttypes.index(qname) + def dump_classdef(type_or_element) + qname = type_or_element.name + if @faulttypes and @faulttypes.index(qname) c = XSD::CodeGen::ClassDef.new(create_class_name(qname), - "::StandardError") + '::StandardError') else c = XSD::CodeGen::ClassDef.new(create_class_name(qname)) end c.comment = "#{ qname.namespace }" - c.def_classvar("schema_type", qname.name.dump) - c.def_classvar("schema_ns", qname.namespace.dump) - init_lines = "" + c.def_classvar('schema_type', qname.name.dump) + c.def_classvar('schema_ns', qname.namespace.dump) + schema_attribute = [] + schema_element = [] + init_lines = '' params = [] - complextype.each_element do |element| + type_or_element.each_element do |element| + next unless element.name name = element.name.name + if element.type == XSD::AnyTypeName + type = nil + elsif basetype = basetype_class(element.type) + type = basetype.name + else + type = create_class_name(element.type) + end + attrname = safemethodname?(name) ? name : safemethodname(name) varname = safevarname(name) - c.def_attr(name, true, varname) + c.def_attr(attrname, true, varname) init_lines << "@#{ varname } = #{ varname }\n" - params << "#{ varname } = nil" + if element.map_as_array? + params << "#{ varname } = []" + type << '[]' + else + params << "#{ varname } = nil" + end + schema_element << [name, type] end - complextype.attributes.each do |attribute| - name = "attr_" + attribute.name - varname = safevarname(name) - c.def_attr(name, true, varname) - init_lines << "@#{ varname } = #{ varname }\n" - params << "#{ varname } = nil" + unless type_or_element.attributes.empty? + type_or_element.attributes.each do |attribute| + name = attribute.name.name + if basetype = basetype_class(attribute.type) + type = basetype_class(attribute.type).name + else + type = nil + end + varname = safevarname('attr_' + name) + c.def_method(varname) do <<-__EOD__ + @__soap_attribute[#{name.dump}] + __EOD__ + end + c.def_method(varname + '=', 'value') do <<-__EOD__ + @__soap_attribute[#{name.dump}] = value + __EOD__ + end + schema_attribute << [name, type] + end + init_lines << "@__soap_attribute = {}\n" end - c.def_method("initialize", *params) do + c.def_classvar('schema_attribute', + '{' + + schema_attribute.collect { |name, type| + name.dump + ' => ' + ndq(type) + }.join(', ') + + '}' + ) + c.def_classvar('schema_element', + '{' + + schema_element.collect { |name, type| + name.dump + ' => ' + ndq(type) + }.join(', ') + + '}' + ) + c.def_method('initialize', *params) do init_lines end c.dump end + def basetype_class(type) + if @simpletypes[type] + basetype_mapped_class(@simpletypes[type].base) + else + basetype_mapped_class(type) + end + end + def dump_arraydef(complextype) qname = complextype.name - c = XSD::CodeGen::ClassDef.new(create_class_name(qname), "::Array") + c = XSD::CodeGen::ClassDef.new(create_class_name(qname), '::Array') c.comment = "#{ qname.namespace }" - c.def_classvar("schema_type", qname.name.dump) - c.def_classvar("schema_ns", qname.namespace.dump) + c.def_classvar('schema_type', qname.name.dump) + c.def_classvar('schema_ns', qname.namespace.dump) c.dump end end diff --git a/lib/wsdl/soap/classDefCreatorSupport.rb b/lib/wsdl/soap/classDefCreatorSupport.rb index dbcc55f7b9..706c00d4f6 100644 --- a/lib/wsdl/soap/classDefCreatorSupport.rb +++ b/lib/wsdl/soap/classDefCreatorSupport.rb @@ -59,6 +59,18 @@ __EOD__ str end + def dq(ele) + ele.dump + end + + def ndq(ele) + ele.nil? ? 'nil' : dq(ele) + end + + def sym(ele) + ':' + ele + end + private def dump_inout_type(param) @@ -66,10 +78,14 @@ private message = param.find_message params = "" message.parts.each do |part| - next unless part.type name = safevarname(part.name) - typename = safeconstname(part.type.name) - params << add_at("# #{name}", "#{typename} - #{part.type}\n", 20) + if part.type + typename = safeconstname(part.type.name) + params << add_at("# #{name}", "#{typename} - #{part.type}\n", 20) + elsif part.element + typename = safeconstname(part.element.name) + params << add_at("# #{name}", "#{typename} - #{part.element}\n", 20) + end end unless params.empty? return params diff --git a/lib/wsdl/soap/clientSkeltonCreator.rb b/lib/wsdl/soap/clientSkeltonCreator.rb index 9c538dd612..0b9e79c718 100644 --- a/lib/wsdl/soap/clientSkeltonCreator.rb +++ b/lib/wsdl/soap/clientSkeltonCreator.rb @@ -62,7 +62,7 @@ __EOD__ def dump_input_init(input) result = input.find_message.parts.collect { |part| - "#{ uncapitalize(part.name) }" + safevarname(part.name) }.join(" = ") if result.empty? "" diff --git a/lib/wsdl/soap/complexType.rb b/lib/wsdl/soap/complexType.rb index 34fc18f1a4..1bed059f7e 100644 --- a/lib/wsdl/soap/complexType.rb +++ b/lib/wsdl/soap/complexType.rb @@ -7,6 +7,7 @@ require 'wsdl/xmlSchema/complexType' +require 'soap/mapping' module WSDL @@ -20,37 +21,58 @@ class ComplexType < Info def check_type if content - if content.elements.size == 1 and content.elements[0].maxoccurs != 1 - :TYPE_ARRAY + if attributes.empty? and + content.elements.size == 1 and content.elements[0].maxoccurs != '1' + if name == ::SOAP::Mapping::MapQName + :TYPE_MAP + else + :TYPE_ARRAY + end else :TYPE_STRUCT end elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName :TYPE_ARRAY + elsif simplecontent + :TYPE_SIMPLE + elsif !attributes.empty? + :TYPE_STRUCT else raise NotImplementedError.new("Unknown kind of complexType.") end end def child_type(name = nil) + type = nil case compoundtype when :TYPE_STRUCT if ele = find_element(name) - ele.type + type = ele.type elsif ele = find_element_by_name(name.name) - ele.type - else - nil + type = ele.type end when :TYPE_ARRAY - @contenttype ||= content_arytype + type = @contenttype ||= content_arytype + when :TYPE_MAP + item_ele = find_element_by_name("item") or + raise RuntimeError.new("'item' element not found in Map definition.") + content = item_ele.local_complextype or + raise RuntimeError.new("No complexType definition for 'item'.") + if ele = content.find_element(name) + type = ele.type + elsif ele = content.find_element_by_name(name.name) + type = ele.type + end + else + raise NotImplementedError.new("Unknown kind of complexType.") end + type end def child_defined_complextype(name) ele = nil case compoundtype - when :TYPE_STRUCT + when :TYPE_STRUCT, :TYPE_MAP unless ele = find_element(name) if name.namespace.nil? ele = find_element_by_name(name.name) @@ -81,7 +103,7 @@ class ComplexType < Info return attribute.arytype end end - elsif content.elements.size == 1 and content.elements[0].maxoccurs != 1 + elsif content.elements.size == 1 and content.elements[0].maxoccurs != '1' return content.elements[0].type else raise RuntimeError.new("Assert: Unknown array definition.") diff --git a/lib/wsdl/soap/data.rb b/lib/wsdl/soap/data.rb index 23aaff83b5..48512d3751 100644 --- a/lib/wsdl/soap/data.rb +++ b/lib/wsdl/soap/data.rb @@ -11,6 +11,7 @@ require 'wsdl/soap/definitions' require 'wsdl/soap/binding' require 'wsdl/soap/operation' require 'wsdl/soap/body' +require 'wsdl/soap/element' require 'wsdl/soap/header' require 'wsdl/soap/headerfault' require 'wsdl/soap/fault' diff --git a/lib/wsdl/soap/driverCreator.rb b/lib/wsdl/soap/driverCreator.rb index 50be8ed1dc..b752ee336d 100644 --- a/lib/wsdl/soap/driverCreator.rb +++ b/lib/wsdl/soap/driverCreator.rb @@ -68,10 +68,15 @@ Methods = [ end c.def_privatemethod("init_methods") do <<-EOD - Methods.each do |name_as, name, params, soapaction, namespace| + Methods.each do |name_as, name, params, soapaction, namespace, style| qname = ::XSD::QName.new(namespace, name_as) - @proxy.add_method(qname, soapaction, name, params) - add_rpc_method_interface(name, params) + if style == :document + @proxy.add_document_method(qname, soapaction, name, params) + add_document_method_interface(name, name_as) + else + @proxy.add_rpc_method(qname, soapaction, name, params) + add_rpc_method_interface(name, params) + end end EOD end diff --git a/lib/wsdl/soap/element.rb b/lib/wsdl/soap/element.rb new file mode 100644 index 0000000000..c39a00d25a --- /dev/null +++ b/lib/wsdl/soap/element.rb @@ -0,0 +1,34 @@ +# WSDL4R - XMLSchema element definition for WSDL. +# Copyright (C) 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; +# either the dual license version in 2003, or any later version. + + +require 'wsdl/xmlSchema/element' + + +module WSDL +module XMLSchema + + +class Element < Info + def map_as_array? + maxoccurs != '1' + end + + def attributes + @local_complextype.attributes + end + + def each_element + @local_complextype.each_element do |element| + yield(element) + end + end +end + + +end +end diff --git a/lib/wsdl/soap/fault.rb b/lib/wsdl/soap/fault.rb index abd3cbe3dd..019c881f97 100644 --- a/lib/wsdl/soap/fault.rb +++ b/lib/wsdl/soap/fault.rb @@ -34,13 +34,13 @@ class Fault < Info def parse_attr(attr, value) case attr when NameAttrName - @name = value + @name = XSD::QName.new(targetnamespace, value.source) when UseAttrName - @use = value + @use = value.source when EncodingStyleAttrName - @encodingstyle = value + @encodingstyle = value.source when NamespaceAttrName - @namespace = value + @namespace = value.source else nil end diff --git a/lib/wsdl/soap/header.rb b/lib/wsdl/soap/header.rb index f1dd69eafb..247531a76d 100644 --- a/lib/wsdl/soap/header.rb +++ b/lib/wsdl/soap/header.rb @@ -59,15 +59,15 @@ class Header < Info def parse_attr(attr, value) case attr when MessageAttrName - @message = value + @message = XSD::QName.new(targetnamespace, value.source) when PartAttrName - @part = value + @part = value.source when UseAttrName - @use = value + @use = value.source when EncodingStyleAttrName - @encodingstyle = value + @encodingstyle = value.source when NamespaceAttrName - @namespace = value + @namespace = value.source else nil end diff --git a/lib/wsdl/soap/headerfault.rb b/lib/wsdl/soap/headerfault.rb index a6e86661c2..d6b14f2646 100644 --- a/lib/wsdl/soap/headerfault.rb +++ b/lib/wsdl/soap/headerfault.rb @@ -38,13 +38,13 @@ class HeaderFault < Info when MessageAttrName @message = value when PartAttrName - @part = value + @part = value.source when UseAttrName - @use = value + @use = value.source when EncodingStyleAttrName - @encodingstyle = value + @encodingstyle = value.source when NamespaceAttrName - @namespace = value + @namespace = value.source else nil end diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb index eded972cdc..59b8ee4253 100644 --- a/lib/wsdl/soap/methodDefCreator.rb +++ b/lib/wsdl/soap/methodDefCreator.rb @@ -45,9 +45,15 @@ private def dump_method(operation, binding) name = safemethodname(operation.name.name) name_as = operation.name.name - params = collect_parameter(operation) - soapaction = binding.soapoperation.soapaction - namespace = binding.input.soapbody.namespace + stylestr = binding.soapoperation.operation_style.id2name + if binding.soapoperation.operation_style == :rpc + soapaction = binding.soapoperation.soapaction + namespace = binding.input.soapbody.namespace + params = collect_rpcparameter(operation) + else + soapaction = namespace = nil + params = collect_documentparameter(operation) + end paramstr = param2str(params) if paramstr.empty? paramstr = '[]' @@ -57,36 +63,45 @@ private return <<__EOD__ [#{ dq(name_as) }, #{ dq(name) }, #{ paramstr }, - #{ soapaction ? dq(soapaction) : "nil" }, #{ dq(namespace) } + #{ ndq(soapaction) }, #{ ndq(namespace) }, #{ sym(stylestr) } ] __EOD__ end - def collect_parameter(operation) + def collect_rpcparameter(operation) result = operation.inputparts.collect { |part| collect_type(part.type) - param_set('in', definedtype(part), part.name) + param_set('in', rpcdefinedtype(part), part.name) } outparts = operation.outputparts if outparts.size > 0 retval = outparts[0] collect_type(retval.type) - result << param_set('retval', definedtype(retval), retval.name) + result << param_set('retval', rpcdefinedtype(retval), retval.name) cdr(outparts).each { |part| collect_type(part.type) - result << param_set('out', definedtype(part), part.name) + result << param_set('out', rpcdefinedtype(part), part.name) } end result end - def definedtype(part) + def collect_documentparameter(operation) + input = operation.inputparts[0] + output = operation.outputparts[0] + [ + param_set('input', documentdefinedtype(input), input.name), + param_set('output', documentdefinedtype(output), output.name) + ] + end + + def rpcdefinedtype(part) if mapped = basetype_mapped_class(part.type) ['::' + mapped.name] - elsif definedelement = @elements[part.element] - raise RuntimeError.new("Part: #{part.name} should be typed for RPC service for now.") elsif definedtype = @simpletypes[part.type] ['::' + basetype_mapped_class(definedtype.base).name] + elsif definedtype = @elements[part.element] + ['::SOAP::SOAPStruct', part.element.namespace, part.element.name] elsif definedtype = @complextypes[part.type] case definedtype.compoundtype when :TYPE_STRUCT @@ -104,6 +119,18 @@ __EOD__ end end + def documentdefinedtype(part) + if definedtype = @simpletypes[part.type] + ['::' + basetype_mapped_class(definedtype.base).name, nil, part.name] + elsif definedtype = @elements[part.element] + ['::SOAP::SOAPElement', part.element.namespace, part.element.name] + elsif definedtype = @complextypes[part.type] + ['::SOAP::SOAPElement', part.type.namespace, part.type.name] + else + raise RuntimeError.new("Part: #{part.name} cannot be resolved.") + end + end + def param_set(io_type, type, name) [io_type, type, name] end @@ -128,14 +155,10 @@ __EOD__ if type.size == 1 "[#{ type[0] }]" else - "[#{ type[0] }, #{ dq(type[1]) }, #{ dq(type[2]) }]" + "[#{ type[0] }, #{ ndq(type[1]) }, #{ dq(type[2]) }]" end end - def dq(ele) - "\"" << ele << "\"" - end - def cdr(ary) result = ary.dup result.shift diff --git a/lib/wsdl/soap/operation.rb b/lib/wsdl/soap/operation.rb index bb49f2099c..51bb2e9403 100644 --- a/lib/wsdl/soap/operation.rb +++ b/lib/wsdl/soap/operation.rb @@ -50,13 +50,14 @@ class Operation < Info def parse_attr(attr, value) case attr when StyleAttrName - if ["document", "rpc"].include?(value) - @style = value.intern + if ["document", "rpc"].include?(value.source) + @style = value.source.intern else - raise AttributeConstraintError.new("Unexpected value #{ value }.") + raise Parser::AttributeConstraintError.new( + "Unexpected value #{ value }.") end when SOAPActionAttrName - @soapaction = value + @soapaction = value.source else nil end diff --git a/lib/wsdl/soap/servantSkeltonCreator.rb b/lib/wsdl/soap/servantSkeltonCreator.rb index bf293949b8..12761ab5b4 100644 --- a/lib/wsdl/soap/servantSkeltonCreator.rb +++ b/lib/wsdl/soap/servantSkeltonCreator.rb @@ -45,14 +45,16 @@ private c = ::XSD::CodeGen::ClassDef.new(class_name) operations = @definitions.porttype(name).operations operations.each do |operation| - name = operation.name.name + name = safemethodname(operation.name.name) input = operation.input - m = ::XSD::CodeGen::MethodDef.new(name, - input.find_message.parts.collect { |part| safevarname(part.name) }) do - <<-EOD - raise NotImplementedError.new - EOD - end + params = input.find_message.parts.collect { |part| + safevarname(part.name) + } + m = ::XSD::CodeGen::MethodDef.new(name, params) do <<-EOD + p [#{params.join(", ")}] + raise NotImplementedError.new + EOD + end m.comment = dump_method_signature(operation) c.add_method(m) end diff --git a/lib/wsdl/soap/standaloneServerStubCreator.rb b/lib/wsdl/soap/standaloneServerStubCreator.rb index 34bcfdbba9..779139a5f4 100644 --- a/lib/wsdl/soap/standaloneServerStubCreator.rb +++ b/lib/wsdl/soap/standaloneServerStubCreator.rb @@ -57,9 +57,13 @@ Methods = [ <<-EOD super(*arg) servant = #{class_name}.new - #{class_name}::Methods.each do |name_as, name, params, soapaction, ns| - qname = XSD::QName.new(ns, name_as) - @soaplet.app_scope_router.add_method(servant, qname, soapaction, name, params) + #{class_name}::Methods.each do |name_as, name, param_def, soapaction, namespace, style| + qname = XSD::QName.new(namespace, name_as) + if style == :document + @soaplet.app_scope_router.add_document_method(servant, qname, soapaction, name, param_def) + else + @soaplet.app_scope_router.add_rpc_method(servant, qname, soapaction, name, param_def) + end end self.mapping_registry = #{class_name}::MappingRegistry EOD @@ -68,7 +72,11 @@ Methods = [ if $0 == __FILE__ # Change listen port. - #{class_name}App.new('app', nil, '0.0.0.0', 10080).start + server = #{class_name}App.new('app', nil, '0.0.0.0', 10080) + trap(:INT) do + server.shutdown + end + server.start end EOD end |