SOAP::Lite -- calling methods with multiple name-value pairs.

"Carter, Robert" <[email protected]> Wed, 13 Oct 2004 13:32:01 -0400
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
In SOAP::Lite, is there a better way to call a method with multiple
name-value pairs?

The below shows how I solved my problem, but I wondered if SOAP::Lite has an
accessor to allow this kind of call directly, passing in the hash of
key-value pairs rather than an array of SOAP::Data objects.

Thanks.


        # calling a method with parameters
        my @params;
        print "\n" if ($DEBUG); # for spacing
        foreach my $name (keys %args) {
            print "DEBUG: name $name value $args{$name}\n" if ($DEBUG);
            push @params, (SOAP::Data->name ($name => $args{$name}));
        }
        $output = $soap_transport_object->call("u:$method" =>
#
SOAP::Data->value(SOAP::Data->name(@args)) # works for single arg:
name-value pair
                                               SOAP::Data->value(@params)
                                               );