summaryrefslogtreecommitdiff
path: root/lib/wsdl/soap/complexType.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 13:50:15 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 13:50:15 +0000
commite5a3aba50e2bd7e0327aacd8fe1ab7963fc4a007 (patch)
treeb56a6e784df74331c28e4a94901b96837f214e35 /lib/wsdl/soap/complexType.rb
parent643dc132113489749c333a6bda14730d9b175ed1 (diff)
* 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/complexType.rb')
-rw-r--r--lib/wsdl/soap/complexType.rb40
1 files changed, 31 insertions, 9 deletions
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.")