summaryrefslogtreecommitdiff
path: root/lib/wsdl/soap/complexType.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl/soap/complexType.rb')
-rw-r--r--lib/wsdl/soap/complexType.rb37
1 files changed, 22 insertions, 15 deletions
diff --git a/lib/wsdl/soap/complexType.rb b/lib/wsdl/soap/complexType.rb
index 1bed059f7e..bba50fd153 100644
--- a/lib/wsdl/soap/complexType.rb
+++ b/lib/wsdl/soap/complexType.rb
@@ -31,42 +31,44 @@ class ComplexType < Info
else
:TYPE_STRUCT
end
- elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName
- :TYPE_ARRAY
+ elsif complexcontent
+ if complexcontent.base == ::SOAP::ValueArrayName
+ :TYPE_ARRAY
+ else
+ complexcontent.basetype.check_type
+ end
elsif simplecontent
:TYPE_SIMPLE
elsif !attributes.empty?
:TYPE_STRUCT
- else
- raise NotImplementedError.new("Unknown kind of complexType.")
+ else # empty complexType definition (seen in partner.wsdl of salesforce)
+ :TYPE_EMPTY
end
end
def child_type(name = nil)
- type = nil
case compoundtype
when :TYPE_STRUCT
if ele = find_element(name)
- type = ele.type
+ ele.type
elsif ele = find_element_by_name(name.name)
- type = ele.type
+ ele.type
end
when :TYPE_ARRAY
- type = @contenttype ||= content_arytype
+ @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
+ ele.type
elsif ele = content.find_element_by_name(name.name)
- type = ele.type
+ ele.type
end
else
raise NotImplementedError.new("Unknown kind of complexType.")
end
- type
end
def child_defined_complextype(name)
@@ -103,16 +105,21 @@ class ComplexType < Info
return attribute.arytype
end
end
- elsif content.elements.size == 1 and content.elements[0].maxoccurs != '1'
+ if check_array_content(complexcontent.content)
+ return complexcontent.content.elements[0].type
+ end
+ elsif check_array_content(content)
return content.elements[0].type
- else
- raise RuntimeError.new("Assert: Unknown array definition.")
end
- nil
+ raise RuntimeError.new("Assert: Unknown array definition.")
end
private
+ def check_array_content(content)
+ content.elements.size == 1 and content.elements[0].maxoccurs != '1'
+ end
+
def content_arytype
if arytype = find_arytype
ns = arytype.namespace