Variable number of parameters on SOAP call?

J

John Allen

Is there a way to specify a variable number of parameters on a SOAP
call?
Example: Ruby client that is trying to call a Perl SOAP server:

dvr = SOAP::RPC::Driver.new("http://samplehost.com:1234", "urn:Test")
dvr.add_method('vartest','user','passwd','opts')

'opts' can be a variable number of options, so its expecting one or
more options to show up. If I pass it something like:

tt = ["test1","test2","test3"]
dvr.vartest("user","pass",tt)

the perl SOAP client gets a one element array of an array....not just a
single array. IE> p[0][0] => "test1", p[0][1] => "test2" p[0][2] =>
"test3" ..what its expecting is p[0] => "test1", p[1] => "test2", p[2]
=> "test3". This works fine from my perl SOAP client.

Is there a standard way to set up a SOAP function to accept a variable
number of parameters?? I can't find anything about it.
Thanks all:)
 
R

Robert Klemme

Is there a way to specify a variable number of parameters on a SOAP
call?
Example: Ruby client that is trying to call a Perl SOAP server:

dvr = SOAP::RPC::Driver.new("http://samplehost.com:1234", "urn:Test")
dvr.add_method('vartest','user','passwd','opts')

'opts' can be a variable number of options, so its expecting one or
more options to show up. If I pass it something like:

tt = ["test1","test2","test3"]
dvr.vartest("user","pass",tt)

the perl SOAP client gets a one element array of an array....not just a
single array. IE> p[0][0] => "test1", p[0][1] => "test2" p[0][2] =>
"test3" ..what its expecting is p[0] => "test1", p[1] => "test2", p[2]
=> "test3". This works fine from my perl SOAP client.

Is there a standard way to set up a SOAP function to accept a variable
number of parameters?? I can't find anything about it.
Thanks all:)

Did you try the splat operator?

dvr.vartest("user", "pass", *tt)
^

Kind regards

robert
 
J

John Allen

Robert said:
Did you try the splat operator?

dvr.vartest("user", "pass", *tt)
^

That just gets me a 'wrong number of arguments (6 for 3)' error.
Thank you for responding :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top