Bug in wsdl4r

Mayby any of you happend to find solution - i generated classes with
wsdl4r
and got this exception, i’m investigating but it’s porbably to deep for
me and
solution might be simple (wrong wsdl perhaps)

========================
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:321:in
add_elements2stubobj': undefined methodname’ for nil:NilClass
(NoMethodError)
from /usr/lib/ruby/1.8/soap/baseData.rb:605:in each' from /usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:292:inadd_elements2stubobj’
from
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:277:in
soapele2stubobj' from /usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:264:inany2obj’
from
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:305:in
add_elements2stubobj' from /usr/lib/ruby/1.8/soap/baseData.rb:605:ineach’
from
/usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:292:in
add_elements2stubobj' from /usr/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:277:insoapele2stubobj’
… 13 levels…
from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:149:in call' from /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:incall’
from (eval):6:in `product_Get’
from /home/swistak/sklep/trunk/soap/DetaExchangeClient.rb:17

===================

Little follow up
from what i’ve found it’s almost certenly bug:

===============================
item = elements.find { |k, v| k.name == name }
if item
elename, class_name = item
if klass = Mapping.class_from_name(class_name)
# klass must be a SOAPBasetype or a class
if klass.ancestors.include?(::soap::SOAPBasetype)
if value.respond_to?(:data)
child = klass.new(value.data).data
else
child = klass.new(nil).data
end
else
child = any2obj(value, klass)
end
elsif klass = Mapping.module_from_name(class_name)
# simpletype
if value.respond_to?(:data)
child = value.data
else
raise MappingError.new(
“cannot map to a module value: #{class_name}”)
end
else
raise MappingError.new(“unknown class/module: #{class_name}”)
end
else # untyped element is treated as anyType.
child = any2obj(value)
end
if as_array.include?(elename.name)
(vars[name] ||= []) << child
else
vars[name] = child
end

elname is never even assigned if item is nil itself

On 7/9/07, Marcin R. [email protected] wrote:

Little follow up
from what i’ve found it’s almost certenly bug:

===============================
item = elements.find { |k, v| k.name == name }
if item
elename, class_name = item

snip

========================
elname is never even assigned if item is nil itself

Correct.

If item is nil, the statement immediately below it (elename,
class_name = item) will not be executed.

Todd

Yea, well quick fix is changing

if as_array.include?(elename.name)
to
if item && elename && as_array.include?(elename.name)