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

315RE: [soaplite] Re: Can the server process parameters by name?

Expand Messages
  • Chris Davies
    May 14, 2001
    • 0 Attachment
      Hi Ashley

      Yes, I'm trying to write a procedure that "does the right thing" depending
      on whether the parameters are named or simply positional.

      Unfortunately, it seems to me that your assumption (viz a SOAP object
      implies named parameters) is incorrect. If you check the supplied parameters
      to the subroutine you'll find that, once you've done a "@ISA =
      qw(SOAP::Server::Parameters)", the parameter list will always have a
      SOAP::SOM object at its end.

      The only way I can see of solving this is to look for the mandatory
      parameter names, and if you find any of them then assume the parameters have
      been passed by name. Ugh!

      Cheers,
      Chris


      -----Original Message-----
      From: Ashley Clark [mailto:aclark@...]
      Sent: Monday, May 14, 2001 2:04 PM
      To: soaplite@yahoogroups.com
      Subject: [soaplite] Re: Can the server process parameters by name?


      * Chris Davies in "Re: Re: Can the server process parameters by name?"
      * dated 2001/05/14 09:46 wrote:

      > Are you able to share the approach? I've posted my offering - but it
      > requires that some parameters are mandatory so it can determine
      > whether names or positions have been used.

      Yes, but the reason I hesitated before was that I did not check for
      whether they are passed by name or position (and I assume that if
      coming as a SOAP object they are named). I think that you are concerned
      with whether they come across the wire named vs. positional, correct?

      --snip--
      sub login {
      my $self = shift;
      my $som, $email, $pass;

      if (ref($_[-1]) eq "SOAP::SOM") {
      $som = pop;
      ($email, $pass) = @{$som->method}{qw(email password)};
      } else {
      ($email, $pass) = @_;
      }

      ...

      return SOAP::Data->name('Result')->type('boolean' => 1);
      }

      --
      hackers ally
    • Show all 26 messages in this topic