SOAP call not returning containers all the time

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 =[: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)
print_node(indent + 1, node.treenode)

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?