# SOAP call not returning containers all the time

**URL:** <https://www.ruby-forum.com/t/soap-call-not-returning-containers-all-the-time/146807>\
**Category:** Ruby\
**Created:** [August 25, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/soap-call-not-returning-containers-all-the-time/146807 "2008-08-25T19:16:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjpatten](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pjpatten](https://www.ruby-forum.com/u/pjpatten)\
**Post date:** [August 25, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/soap-call-not-returning-containers-all-the-time/146807/1 "2008-08-25T19:16:46Z")

</div>

Hello all!

I’m new here, and pretty new to Ruby. So far I like using it.

I have a question though. I’m working with SOAP. Everythings works well,  
but there is one strange thing. If I get a node that can contain zero or  
more entries of a type, I do not always get a container with these  
values. If there are 2 or more values, I will have an array. If there is  
only one, I do not get an array that is just one long, but get a  
separate value. Very strange in my opinion. Piece of code:

@driver = SOAP::WSDLDriverFactory.new(@config[:wsdl]).create\_rpc\_driver  
@driver.wiredump\_dev = $STDERR

… some more code …

if defined?(node.treenode)  
if node.treenode.is\_a?(Array)  
node.treenode.each { |item|  
print\_node(indent + 1, item)  
}  
else  
print\_node(indent + 1, node.treenode)  
end  
end

The first check on “is there a node” I do not mind, but is already not  
so nice: why not just have an empty array?

The second check is in my humble opinion stupid…

Can I somehow change this behaviour? Or do I overlook something?
