diff options
Diffstat (limited to 'lib/wsdl/soap/complexType.rb')
-rw-r--r-- | lib/wsdl/soap/complexType.rb | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/lib/wsdl/soap/complexType.rb b/lib/wsdl/soap/complexType.rb index f47ddee449..e9818faa9a 100644 --- a/lib/wsdl/soap/complexType.rb +++ b/lib/wsdl/soap/complexType.rb @@ -1,20 +1,9 @@ -=begin -WSDL4R - SOAP complexType definition for WSDL. -Copyright (C) 2002, 2003 NAKAMURA, Hiroshi. +# WSDL4R - SOAP complexType definition for WSDL. +# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PRATICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 675 Mass -Ave, Cambridge, MA 02139, USA. -=end +# 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/complexType' @@ -31,7 +20,11 @@ class ComplexType < Info def check_type if content - :TYPE_STRUCT + if content.elements.size == 1 and content.elements[0].maxoccurs != 1 + :TYPE_ARRAY + else + :TYPE_STRUCT + end elsif complexcontent and complexcontent.base == ::SOAP::ValueArrayName :TYPE_ARRAY else @@ -70,10 +63,19 @@ class ComplexType < Info end def find_arytype - complexcontent.attributes.each do |attribute| - if attribute.ref == ::SOAP::AttrArrayTypeName - return attribute.arytype + unless compoundtype == :TYPE_ARRAY + raise RuntimeError.new("Assert: not for array") + end + if complexcontent + complexcontent.attributes.each do |attribute| + if attribute.ref == ::SOAP::AttrArrayTypeName + return attribute.arytype + end end + elsif content.elements.size == 1 and content.elements[0].maxoccurs != 1 + return content.elements[0].type + else + raise RuntimeError.new("Assert: Unknown array definition.") end nil end @@ -81,9 +83,6 @@ class ComplexType < Info private def content_arytype - unless compoundtype == :TYPE_ARRAY - raise RuntimeError.new("Assert: not for array") - end arytype = find_arytype ns = arytype.namespace name = arytype.name.sub(/\[(?:,)*\]$/, '') |