Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Calling methods with array parameters

Expand Messages
  • Duncan Cameron
    ... You could do with an example from the people who wrote the spec! ... Possibly, provide a reference to an array of hashes, each of which contains the
    Message 1 of 1 , Aug 20 2:28 PM
    • 0 Attachment
      On 2002-08-20 sergio_rotstein wrote:
      >Folks, I think this won't be the smartest question ever posted in this
      >newsgroup, but after trying a whole bunch of different things, I could
      >well use some advice. I have a soap service that I'm trying to call
      >from a perl client via SOAP::Lite. I have no problem calling methods
      >where the parameters are simple (e.g. strings). However, some of the
      >methods I need to call have more complicated parameters and the short
      >of it is, I don't know how to set up the call.
      >
      >For example, the "Login" method calls for two strings, "username" and
      >"password":
      >
      >$myResult = $soapHandle
      > -> Login(SOAP::Data->name('username' => 'sergio'),
      > SOAP::Data->name('password' => 'sergio'));
      >
      >The above example works just fine, and I can pull a run handle from
      >$myResult.
      >
      >On the other hand, there's another method I need to call named
      >"RunRemoteProg". This method calls for 3 parameters:
      >
      >(1) runHandle (simple string, no problemo)
      >(2) name (the name of a remote program to run, also a simple string)
      >(3) progParams
      >
      >It's in (3) that I get stuck. the spec states that progParams is "An
      >array of "ParameterValue" structures representing the parameters
      >for the remote program". A ParameterValue structure, in turn is
      >defined as having a name (string) and a value ("an array of strings
      >containing the parameter values").
      >
      >In short, a parameterValue is a "name + valueArray" pair, and I need
      >to call my method with an array of parameterValue(s)!

      You could do with an example from the people who wrote the spec!

      >So, right now I'm stuck at:
      >
      >$myResult = $soapHandle
      > -> RunRemoteProg(
      > SOAP::Data->name('runHandle' => $myRunHandle),
      > SOAP::Data->name('name' => $targetProg),
      > SOAP::Data->name('parameters' => WHAT SHOULD GO
      >HERE??)


      Possibly, provide a reference to an array of hashes, each of which
      contains the parameter name and an array of values. Why an array of
      values rather than one?

      Maybe something like this:

      my $p = SOAP::Data->name(progParams => [
      {pname => 'p1', pvalue => [1]},
      {pname => 'p2', pvalue => [2]},
      {pname => 'p3', pvalue => [3, 4, 5,]},
      ]);
      But you really need an example!

      >Also, while I'm at it, I've noticed a number of posts where people are
      >showing the outgoing soap evelope, which seems to be a great way of
      >diagnosing things... Is there a method that will print that out in a
      >nice xml format (I've been looking at things using Data::Dumper, but
      >it's not so good for this kind of thing...)?
      >

      use SOAP::Lite +trace => debug;

      Regards,
      Duncan Cameron
    Your message has been successfully submitted and would be delivered to recipients shortly.