Variable number of parameters on SOAP call?

Discussion in 'Ruby' started by John Allen, Mar 3, 2009.

  1. John Allen

    John Allen Guest

    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:)
    --
    Posted via http://www.ruby-forum.com/.
    John Allen, Mar 3, 2009
    #1
    1. Advertising

  2. On 03.03.2009 18:26, John Allen wrote:
    > 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
    Robert Klemme, Mar 3, 2009
    #2
    1. Advertising

  3. John Allen

    John Allen Guest

    Robert Klemme wrote:
    > 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 :)

    --
    Posted via http://www.ruby-forum.com/.
    John Allen, Mar 3, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shaggystyle
    Replies:
    4
    Views:
    12,550
    lallous
    Feb 20, 2004
  2. Michael Cohen

    getting and passing variable number of parameters

    Michael Cohen, Dec 25, 2003, in forum: C Programming
    Replies:
    2
    Views:
    404
    David M. Wilson
    Dec 26, 2003
  3. Felix Kater

    Variable number of parameters in a function call?

    Felix Kater, Oct 9, 2004, in forum: C Programming
    Replies:
    10
    Views:
    496
    John Bode
    Oct 11, 2004
  4. Andrew
    Replies:
    18
    Views:
    946
    Jonathan Mcdougall
    May 23, 2006
  5. arne
    Replies:
    16
    Views:
    608
    William Hughes
    Mar 16, 2007
Loading...

Share This Page