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

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

Expand Messages
  • Larry Mulcahy
    Great, that works! Next question :( I would like to use SOAP::Lite to call a function with something like a list of records. I d like to have the list or array
    Message 1 of 26 , Apr 27, 2001
      Great, that works!

      Next question :(

      I would like to use SOAP::Lite to call a function with something
      like a list of records.

      I'd like to have the list or array named, and also have the
      elements of each record be named.

      Attached are another client and server test program. I don't
      know how to write the server. List-server.perl as written
      writes the following to the server's error log when invoked
      as a CGI application by list-client.perl, showing that it's
      keeping the parameter values but losing the names:

      222
      333
      111
      22
      33
      11

      Third attachment is a slightly tidied up capture of the
      XML request, showing that the a, b and c names are making it this
      far.

      Can this be done with SOAP::Lite?

      Paul Kulchenko wrote:
      >
      > Hi, Larry!
      >
      > Definitely. Put BEGIN {} block aroung package declaration:
      >
      > #!/usr/local/bin/perl
      >
      > use SOAP::Transport::HTTP;
      >
      > SOAP::Transport::HTTP::CGI
      > -> dispatch_to('PARAMS')
      > -> handle;
      >
      > BEGIN {
      >
      > package PARAMS;
      >
      > use vars qw(@ISA);
      > @ISA = qw(SOAP::Server::Parameters);
      >
      > sub ParamsTest
      > {
      > my($a, $b, $c) = @{pop->method}{qw(a b c)};
      > return "a=$a, b=$b, c=$c";
      > }
      >
      > }
      >
      > Inheritance (@ISA) doesn't work unless you declare module BEFORE
      > usage or put it in BEGIN block. Important ONLY if your package
      > declaration is in the same file where you use it. Hope it helps.
      >
      > Best wishes, Paul.

      --
      Larry Mulcahy lmulcahy@...
      PGP public key at:
      http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
    • Chris Davies
      Hi folks, Is it reasonable to provide a procedure that can handle arguments supplied either by name and by position? I can see one way of implementing this:
      Message 2 of 26 , Apr 30, 2001

        Hi folks,

        Is it reasonable to provide a procedure that can handle arguments supplied either by name and by position? I can see one way of implementing this:

        package ByNameOrPos;

        use strict;
        use vars qw(@ISA);
        @ISA = qw(SOAP::Server::Parameters);

        sub ParamsTest
        {
            my $self = shift @_;                        # Class
            my $envelope = pop @_;                      # Envelope
            my $argshash = $envelope->method;           # Args by name
            my ($fruit, $vegetable, $meat) = @_;        # Args by pos

            # Check to see whether args have been passed by name
            my ($byName, $missing) = (0, 0);
            foreach my $mandatory (qw(fruit vegetable meat)) {
                $byName = 1 if exists $argshash->{$mandatory};
                $missing = 1 if not exists $argshash->{$mandatory};
            }
            $missing = 0 unless $byName;
           
            warn "byName=$byName, missing=$missing: fruit=$fruit, vegetable=$vegetable, meat=$meat; self=$self, envelope=$envelope, argshash=$argshash";
           
            my $byName = join (", ", map { "$_ => $argshash->{$_}" } sort keys %$argshash);
            my $byPosn = join (", ", @_);
           
            return "Given ($byName) by name and ($byPosn) by position." .
                ' Args ' . ($byName ? 'passed by name' : 'probably passed by position') . '.' .
                ($missing ? ' Some mandatory parameters are missing.' : '');
        }

        Is there a more reliable or more elegant technique that I can use instead of this? For starters, my proposed solution breaks if there are no mandatory parameters against which to check.

        For completeness, here's how I call this from SOAPsh.pl:

        > ParamsTest('apple', 'spinach', 'chicken')
        --- SOAP RESULT ---
        'Given (c-gensym215 => apple, c-gensym217 => spinach, c-gensym219 => chicken) by name and (apple, spinach, chicken) by position. Args passed by name.'

        > ParamsTest(SOAP::Data->name(meat=>'beef'),SOAP::Data->name(fruit=>'apricot'),SOAP::Data->name(vegetable=>'carrot'))
        --- SOAP RESULT ---
        'Given (fruit => apricot, meat => beef, vegetable => carrot) by name and (beef, apricot, carrot) by position. Args passed by name.'

        >

        ParamsTest(SOAP::Data->name(meat=>'beef'),SOAP::Data->name(fruit=>'apricot'))
        --- SOAP RESULT ---
        'Given (fruit => apricot, meat => beef) by name and (beef, apricot) by position. Args passed by name. Some mandatory parameters are missing.'

        I also would expect to have to massage the provided parameter names if something like MS .NET were to call this procedure with arguments by name, but in the interests of simplicity I'm ignoring that for now.

        Thanks,
        Chris

      • Chris Davies
        Do I take it that everyone reckons it s a stupid requirement? Thanks, Chris ... From: Chris Davies [mailto:Chris.Davies@ManheimEurope.com] Sent: Monday, April
        Message 3 of 26 , May 11, 2001
          Do I take it that everyone reckons it's a stupid requirement?

          Thanks,
          Chris


          -----Original Message-----
          From: Chris Davies [mailto:Chris.Davies@...]
          Sent: Monday, April 30, 2001 2:48 PM
          To: SOAP Lite mailing list
          Subject: RE: [soaplite] Can the server process parameters by name?


          Hi folks,
          Is it reasonable to provide a procedure that can handle arguments supplied
          either by name and by position? I can see one way of implementing this

          [...snip...]
        • Ashley Clark
          * Chris Davies in Re: Can the server process parameters by name? ... I have some methods that handle arguments by parameter (using SOAP::SOM) as well as
          Message 4 of 26 , May 11, 2001
            * Chris Davies in "Re: Can the server process parameters by name?"
            * dated 2001/05/11 17:47 wrote:

            > Do I take it that everyone reckons it's a stupid requirement?

            I have some methods that handle arguments by parameter (using
            SOAP::SOM) as well as position. I only do this though so that I can
            call some objects without going through SOAP (local SOAP objects?)

            --
            shaky cellar
          • Robert Barta
            ... I found this in my archive, maybe it helps: rho ... Paul Kulchenko wrote: .... Definitely. Put BEGIN {} block aroung package declaration:
            Message 5 of 26 , May 11, 2001
              Chris Davies wrote:
              >
              > Do I take it that everyone reckons it's a stupid requirement?

              I found this in my archive, maybe it helps:

              \rho

              -------------

              Paul Kulchenko wrote:

              ....

              Definitely. Put BEGIN {} block aroung package declaration:

              #!/usr/local/bin/perl

              use SOAP::Transport::HTTP;

              SOAP::Transport::HTTP::CGI
              -> dispatch_to('PARAMS')
              -> handle;

              BEGIN {

              package PARAMS;

              use vars qw(@ISA);
              @ISA = qw(SOAP::Server::Parameters);

              sub ParamsTest
              {
              my($a, $b, $c) = @{pop->method}{qw(a b c)};
              return "a=$a, b=$b, c=$c";
              }

              }

              Inheritance (@ISA) doesn't work unless you declare module BEFORE
              usage or put it in BEGIN block. Important ONLY if your package
              declaration is in the same file where you use it. Hope it helps.

              Best wishes, Paul.

              --- Larry Mulcahy <lmulcahy@...> wrote:
              > Hmm, it works when I rewrite my CGI script as a .pm module
              > and have my mod_perl SOAP::Apache module dynamically load it.
              > Is it possible to do this as a CGI script?
              >
              > Larry Mulcahy wrote:
              > >
              > > I'm also trying to get named parameters to work.
              > > After looking at
              > >
              >
              http://discuss.develop.com/archives/wa.exe?A2=ind0104&L=soap&F=&S=&P=11652
              > > as well as the code in examples/parametersbyname.pl and
              > > examples/My/Parameters.pm I thought I understood what to do.
              > > The two attached files show my client and server code.
              > > The client fails with the message:
              > >
              > > $ ./params-client.perl
              > > Can't call method "method" without a package or object reference
              > at
              > > /usr/local/apache/cgi-bin-open/params-server.perl line 17.
              > >
              > > What's wrong?!?!
              >
              > --
              > Larry Mulcahy lmulcahy@...
              > PGP public key at:
              > http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
              >
              > To unsubscribe from this group, send an email to:
              > soaplite-unsubscribe@yahoogroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to
              > http://docs.yahoo.com/info/terms/
              >
              >

              ------------------

              > -----Original Message-----
              > From: Chris Davies [mailto:Chris.Davies@...]
              > Sent: Monday, April 30, 2001 2:48 PM
              > To: SOAP Lite mailing list
              > Subject: RE: [soaplite] Can the server process parameters by name?
              >
              > Hi folks,
              > Is it reasonable to provide a procedure that can handle arguments supplied
              > either by name and by position? I can see one way of implementing this
              >
              > [...snip...]
              >
              > To unsubscribe from this group, send an email to:
              > soaplite-unsubscribe@yahoogroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            • Chris Davies
              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
              Message 6 of 26 , May 14, 2001
                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.

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


                * Chris Davies in "Re: Can the server process parameters by name?"
                * dated 2001/05/11 17:47 wrote:

                > Do I take it that everyone reckons it's a stupid requirement?

                I have some methods that handle arguments by parameter (using
                SOAP::SOM) as well as position. I only do this though so that I can
                call some objects without going through SOAP (local SOAP objects?)

                --
                shaky cellar
              • Chris Davies
                It may be a useful answer to some other question, but unfortunately it doesn t answer my original posting. See
                Message 7 of 26 , May 14, 2001
                  It may be a useful answer to some other question, but unfortunately it
                  doesn't answer my original posting. See
                  http://groups.yahoo.com/group/soaplite/message/271 if you like.

                  Cheers,
                  Chris


                  -----Original Message-----
                  From: rho@... [mailto:rho@...]On
                  Behalf Of Robert Barta
                  Sent: Friday, May 11, 2001 8:45 PM
                  To: soaplite@yahoogroups.com
                  Subject: Re: [soaplite] Can the server process parameters by name?



                  Chris Davies wrote:
                  >
                  > Do I take it that everyone reckons it's a stupid requirement?

                  I found this in my archive, maybe it helps:

                  \rho

                  -------------

                  Paul Kulchenko wrote:

                  ....

                  Definitely. Put BEGIN {} block aroung package declaration:

                  #!/usr/local/bin/perl

                  use SOAP::Transport::HTTP;

                  SOAP::Transport::HTTP::CGI
                  -> dispatch_to('PARAMS')
                  -> handle;

                  BEGIN {

                  package PARAMS;

                  use vars qw(@ISA);
                  @ISA = qw(SOAP::Server::Parameters);

                  sub ParamsTest
                  {
                  my($a, $b, $c) = @{pop->method}{qw(a b c)};
                  return "a=$a, b=$b, c=$c";
                  }

                  }

                  Inheritance (@ISA) doesn't work unless you declare module BEFORE
                  usage or put it in BEGIN block. Important ONLY if your package
                  declaration is in the same file where you use it. Hope it helps.

                  Best wishes, Paul.

                  --- Larry Mulcahy <lmulcahy@...> wrote:
                  > Hmm, it works when I rewrite my CGI script as a .pm module
                  > and have my mod_perl SOAP::Apache module dynamically load it.
                  > Is it possible to do this as a CGI script?
                  >
                  > Larry Mulcahy wrote:
                  > >
                  > > I'm also trying to get named parameters to work.
                  > > After looking at
                  > >
                  >
                  http://discuss.develop.com/archives/wa.exe?A2=ind0104&L=soap&F=&S=&P=11652
                  > > as well as the code in examples/parametersbyname.pl and
                  > > examples/My/Parameters.pm I thought I understood what to do.
                  > > The two attached files show my client and server code.
                  > > The client fails with the message:
                  > >
                  > > $ ./params-client.perl
                  > > Can't call method "method" without a package or object reference
                  > at
                  > > /usr/local/apache/cgi-bin-open/params-server.perl line 17.
                  > >
                  > > What's wrong?!?!
                  >
                  > --
                  > Larry Mulcahy lmulcahy@...
                  > PGP public key at:
                  > http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
                  >
                  > To unsubscribe from this group, send an email to:
                  > soaplite-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to
                  > http://docs.yahoo.com/info/terms/
                  >
                  >

                  ------------------

                  > -----Original Message-----
                  > From: Chris Davies [mailto:Chris.Davies@...]
                  > Sent: Monday, April 30, 2001 2:48 PM
                  > To: SOAP Lite mailing list
                  > Subject: RE: [soaplite] Can the server process parameters by name?
                  >
                  > Hi folks,
                  > Is it reasonable to provide a procedure that can handle arguments supplied
                  > either by name and by position? I can see one way of implementing this
                  >
                  > [...snip...]
                  >
                  > To unsubscribe from this group, send an email to:
                  > soaplite-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

                  To unsubscribe from this group, send an email to:
                  soaplite-unsubscribe@yahoogroups.com



                  Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                • Ashley Clark
                  * Chris Davies in Re: Re: Can the server process parameters by name? ... Yes, but the reason I hesitated before was that I did not check for whether they are
                  Message 8 of 26 , May 14, 2001
                    * 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
                  • Chris Davies
                    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,
                    Message 9 of 26 , May 14, 2001
                      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
                    • Ashley Clark
                      * Chris Davies in Re: Re: Can the server process parameters by name? ... Yes, that is correct. I only recently understood exactly what you were trying to do.
                      Message 10 of 26 , May 14, 2001
                        * Chris Davies in "Re: Re: Can the server process parameters by name?"
                        * dated 2001/05/14 14:42 wrote:

                        > 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.

                        Yes, that is correct. I only recently understood exactly what you were
                        trying to do. Passing parameters by name is simply a requirement to use
                        our objects, so if there is an SOM object at the end then I know it is
                        either improperly formed (no named params) or contains the correct
                        list. I left out a little where I check for validity of parameters
                        passed, regardless of posit/name status.

                        > 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!

                        Likewise.

                        --
                        really shack
                      • Paul Kulchenko
                        Hi, Ashley! ... Right, and it seems to be general problem. I would like to include methods, so you don t need to implement it yourself, like paramsByOrder(@_),
                        Message 11 of 26 , May 14, 2001
                          Hi, Ashley!

                          > > 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!
                          >
                          > Likewise.
                          Right, and it seems to be general problem. I would like to include
                          methods, so you don't need to implement it yourself, like
                          paramsByOrder(@_), paramsByName(['a', 'b', 'c'], @_),
                          paramsByNameOrOrder(['a', 'b', 'c'], @_), which is the same as
                          paramsByName, but will also return parameters by order if there is NO
                          ONE parameter with specified name.

                          In your code you can decide do you want to continue if you have onle
                          one parameter instead of three or die.

                          Another option might be to add description to your method which says
                          that "I'm accepting parameters with names, 'a', 'b' and 'c'", so SOAP
                          processor will take care about passing parameters in this particular
                          order, and you get them by-order, because they already arranged for
                          you. Don't promise it in the next version, but I'm working on it.

                          Best wishes, Paul.

                          --- Ashley Clark <aclark@...> wrote:
                          > * Chris Davies in "Re: Re: Can the server process parameters by
                          > name?"
                          > * dated 2001/05/14 14:42 wrote:
                          >
                          > > 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.
                          >
                          > Yes, that is correct. I only recently understood exactly what you
                          > were
                          > trying to do. Passing parameters by name is simply a requirement to
                          > use
                          > our objects, so if there is an SOM object at the end then I know it
                          > is
                          > either improperly formed (no named params) or contains the correct
                          > list. I left out a little where I check for validity of parameters
                          > passed, regardless of posit/name status.
                          >
                          > > 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!
                          >
                          > Likewise.
                          >
                          > --
                          > really shack
                          >

                          > ATTACHMENT part 2 application/pgp-signature



                          __________________________________________________
                          Do You Yahoo!?
                          Yahoo! Auctions - buy the things you want at great prices
                          http://auctions.yahoo.com/
                        • Chris Davies
                          Actually that quote was from me, but no matter. Thanks for the update Regards, Chris ... From: Paul Kulchenko [mailto:paulclinger@yahoo.com] Sent: Monday, May
                          Message 12 of 26 , May 14, 2001
                            Actually that quote was from me, but no matter. Thanks for the update

                            Regards,
                            Chris

                            -----Original Message-----
                            From: Paul Kulchenko [mailto:paulclinger@...]
                            Sent: Monday, May 14, 2001 4:24 PM
                            To: soaplite@yahoogroups.com
                            Subject: Re: [soaplite] Re: Can the server process parameters by name?

                            Hi, Ashley!

                            > > 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!
                          • paulclinger@yahoo.com
                            Hi, Chris! ... Truly only you can decide. How it happens usually: you write server and advertise methods and parameters, so everybody can use it. If your
                            Message 13 of 26 , May 14, 2001
                              Hi, Chris!

                              --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                              > Is it reasonable to provide a procedure that can handle arguments
                              > supplied either by name and by position?
                              Truly only you can decide. How it happens usually: you write server
                              and advertise methods and parameters, so everybody can use it. If
                              your parameters have names, client should specify it in request. But,
                              you can also ALLOW them to have a choice:
                              1. You can call this method with NAMED parameters in ANY order or
                              2. You can call this method with ORDERED parameters in SPECIFIED order

                              Then all that you need to do is check for presence of NAMED
                              parameters and if there is no single one (with names you're looking
                              for), get them by-order. In my understanding you have three choices:
                              by-order, by-name and by-name-or-by-order. You did it right, but I
                              think it should be included in the library, so you don't need to
                              duplicate this code in your methods. Does it answer your question?
                              BTW, there is no consensus on soapbuilders list on should by-order
                              parameters be allowed or not. I personally think they should, but I
                              represent minority in this aspect :).

                              Best wishes, Paul.

                              P.S. as far as I understand there is no need to check for
                              mandatory/optional parameters in paramByName.

                              >I can see one way of implementing this:
                              >
                              > package ByNameOrPos;
                              >
                              > use strict;
                              > use vars qw(@ISA);
                              > @ISA = qw(SOAP::Server::Parameters);
                              >
                              > sub ParamsTest
                              > {
                              > my $self = shift @_; # Class
                              > my $envelope = pop @_; # Envelope
                              > my $argshash = $envelope->method; # Args by name
                              > my ($fruit, $vegetable, $meat) = @_; # Args by pos
                              >
                              > # Check to see whether args have been passed by name
                              > my ($byName, $missing) = (0, 0);
                              > foreach my $mandatory (qw(fruit vegetable meat)) {
                              > $byName = 1 if exists $argshash->{$mandatory};
                              > $missing = 1 if not exists $argshash->{$mandatory};
                              > }
                              > $missing = 0 unless $byName;
                              >
                              > warn "byName=$byName, missing=$missing: fruit=$fruit,
                              > vegetable=$vegetable, meat=$meat; self=$self, envelope=$envelope,
                              > argshash=$argshash";
                              >
                              > my $byName = join (", ", map { "$_ => $argshash->{$_}" } sort
                              keys
                              > %$argshash);
                              > my $byPosn = join (", ", @_);
                              >
                              > return "Given ($byName) by name and ($byPosn) by position." .
                              > ' Args ' . ($byName ? 'passed by name' : 'probably passed by
                              > position') . '.' .
                              > ($missing ? ' Some mandatory parameters are missing.' : '');
                              > }
                              >
                              > Is there a more reliable or more elegant technique that I can use
                              instead of
                              > this? For starters, my proposed solution breaks if there are no
                              mandatory
                              > parameters against which to check.
                              >
                              > For completeness, here's how I call this from SOAPsh.pl:
                              >
                              > > ParamsTest('apple', 'spinach', 'chicken')
                              > --- SOAP RESULT ---
                              > 'Given (c-gensym215 => apple, c-gensym217 => spinach, c-gensym219 =>
                              > chicken) by name and (apple, spinach, chicken) by position. Args
                              passed by
                              > name.'
                              >
                              > >
                              > ParamsTest(SOAP::Data->name(meat=>'beef'),SOAP::Data->name
                              (fruit=>'apricot')
                              > ,SOAP::Data->name(vegetable=>'carrot'))
                              > --- SOAP RESULT ---
                              > 'Given (fruit => apricot, meat => beef, vegetable => carrot) by
                              name and
                              > (beef, apricot, carrot) by position. Args passed by name.'
                              >
                              > >
                              > ParamsTest(SOAP::Data->name(meat=>'beef'),SOAP::Data->name
                              (fruit=>'apricot')
                              > )
                              > --- SOAP RESULT ---
                              > 'Given (fruit => apricot, meat => beef) by name and (beef, apricot)
                              by
                              > position. Args passed by name. Some mandatory parameters are
                              missing.'
                              >
                              > I also would expect to have to massage the provided parameter names
                              if
                              > something like MS .NET were to call this procedure with arguments
                              by name,
                              > but in the interests of simplicity I'm ignoring that for now.
                              >
                              > Thanks,
                              > Chris
                            • One4K4
                              Maybe an option would be to have little wrapper subroutines: sub byposGetAcctNumber { my $self = shift; my ($name,$ss) = @_;
                              Message 14 of 26 , Jun 13, 2002
                                Maybe an option would be to have little "wrapper" subroutines:

                                sub byposGetAcctNumber {
                                my $self = shift;
                                my ($name,$ss) = @_;
                                GetAcctNumber(name=>$name,ss=>$ss);
                                }

                                sub bynameGetAcctNumber {
                                my $self = shift;
                                my $args = (@_);
                                GetAcctNumber(name=>$args{name},ss=>$args{ss});
                                }

                                ? Just my $0.02;

                                -Tom

                                --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                > Actually that quote was from me, but no matter. Thanks for the
                                update
                                >
                                > Regards,
                                > Chris
                                >
                                > -----Original Message-----
                                > From: Paul Kulchenko [mailto:paulclinger@y...]
                                > Sent: Monday, May 14, 2001 4:24 PM
                                > To: soaplite@y...
                                > Subject: Re: [soaplite] Re: Can the server process parameters by
                                name?
                                >
                                > Hi, Ashley!
                                >
                                > > > 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!
                              • Keanan Smith
                                Err shouldn t that be: sub bynameGetAcctNumber { my $self = shift; my %args = (@_); GetAcctNumber(name= $args{name},ss= $args{ss}); } (Note the % on the 1st
                                Message 15 of 26 , Jun 13, 2002
                                  Err shouldn't that be:

                                  sub bynameGetAcctNumber {
                                  my $self = shift;
                                  my %args = (@_);
                                  GetAcctNumber(name=>$args{name},ss=>$args{ss});
                                  }

                                  (Note the % on the 1st args)
                                  ??
                                  -----Original Message-----
                                  From: One4K4 [mailto:one4k4@...]
                                  Sent: Thursday, June 13, 2002 8:23 AM
                                  To: soaplite@yahoogroups.com
                                  Subject: [soaplite] Re: Can the server process parameters by name?


                                  Maybe an option would be to have little "wrapper" subroutines:

                                  sub byposGetAcctNumber {
                                  my $self = shift;
                                  my ($name,$ss) = @_;
                                  GetAcctNumber(name=>$name,ss=>$ss);
                                  }

                                  sub bynameGetAcctNumber {
                                  my $self = shift;
                                  my $args = (@_);
                                  GetAcctNumber(name=>$args{name},ss=>$args{ss});
                                  }

                                  ? Just my $0.02;

                                  -Tom

                                  --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                  > Actually that quote was from me, but no matter. Thanks for the
                                  update
                                  >
                                  > Regards,
                                  > Chris
                                  >
                                  > -----Original Message-----
                                  > From: Paul Kulchenko [mailto:paulclinger@y...]
                                  > Sent: Monday, May 14, 2001 4:24 PM
                                  > To: soaplite@y...
                                  > Subject: Re: [soaplite] Re: Can the server process parameters by
                                  name?
                                  >
                                  > Hi, Ashley!
                                  >
                                  > > > 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!



                                  To unsubscribe from this group, send an email to:
                                  soaplite-unsubscribe@yahoogroups.com



                                  Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                                • One4K4
                                  Yes, yes it should. I m left handed. ;) ... http://docs.yahoo.com/info/terms/
                                  Message 16 of 26 , Jun 13, 2002
                                    Yes, yes it should. I'm left handed. ;)

                                    --- In soaplite@y..., Keanan Smith <KSmith@n...> wrote:
                                    > Err shouldn't that be:
                                    >
                                    > sub bynameGetAcctNumber {
                                    > my $self = shift;
                                    > my %args = (@_);
                                    > GetAcctNumber(name=>$args{name},ss=>$args{ss});
                                    > }
                                    >
                                    > (Note the % on the 1st args)
                                    > ??
                                    > -----Original Message-----
                                    > From: One4K4 [mailto:one4k4@y...]
                                    > Sent: Thursday, June 13, 2002 8:23 AM
                                    > To: soaplite@y...
                                    > Subject: [soaplite] Re: Can the server process parameters by name?
                                    >
                                    >
                                    > Maybe an option would be to have little "wrapper" subroutines:
                                    >
                                    > sub byposGetAcctNumber {
                                    > my $self = shift;
                                    > my ($name,$ss) = @_;
                                    > GetAcctNumber(name=>$name,ss=>$ss);
                                    > }
                                    >
                                    > sub bynameGetAcctNumber {
                                    > my $self = shift;
                                    > my $args = (@_);
                                    > GetAcctNumber(name=>$args{name},ss=>$args{ss});
                                    > }
                                    >
                                    > ? Just my $0.02;
                                    >
                                    > -Tom
                                    >
                                    > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                    > > Actually that quote was from me, but no matter. Thanks for the
                                    > update
                                    > >
                                    > > Regards,
                                    > > Chris
                                    > >
                                    > > -----Original Message-----
                                    > > From: Paul Kulchenko [mailto:paulclinger@y...]
                                    > > Sent: Monday, May 14, 2001 4:24 PM
                                    > > To: soaplite@y...
                                    > > Subject: Re: [soaplite] Re: Can the server process parameters by
                                    > name?
                                    > >
                                    > > Hi, Ashley!
                                    > >
                                    > > > > 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!
                                    >
                                    >
                                    >
                                    > To unsubscribe from this group, send an email to:
                                    > soaplite-unsubscribe@y...
                                    >
                                    >
                                    >
                                    > Your use of Yahoo! Groups is subject to
                                    http://docs.yahoo.com/info/terms/
                                  • One4K4
                                    ... Every method on server side will be called as class/object method, so it will get an object reference or a class name as the first parameter, then the
                                    Message 17 of 26 , Jun 13, 2002
                                      From the SOAP::Lite pod docs:
                                      ------------------------------------------------------
                                      Every method on server side will be called as class/object method, so
                                      it will get an object reference or a class name as the first
                                      parameter, then the method parameters, and then an envelope as
                                      SOAP::SOM object. Shortly:

                                      $self [, @parameters] , $envelope

                                      If you have a fixed number of parameters, you can do:

                                      my $self = shift;
                                      my($param1, $param2) = @_;

                                      and ignore the envelope. If you need access to the envelope you can
                                      do:

                                      my $envelope = pop;

                                      since the envelope is always the last element in the parameters list.
                                      The byname() method pop->method will return a hash with parameter
                                      names as hash keys and parameter values as hash values:

                                      my($a, $b, $c) = @{pop->method}{qw(a b c)};

                                      gives you by-name access to your parameters.
                                      ------------------------------------------------------

                                      my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                      I've tried that... but for some reason there is *no envelope* at the
                                      end of @_ ?!

                                      -Tom


                                      --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                      > I'm using a SOAP::Lite server with version 0.46 of SOAP::Lite.
                                      >
                                      > My colleagues in a.n.other company want to use named parameters
                                      (rather than
                                      > positional ones) to talk to my SOAP::Lite server. They are using
                                      MS .NET,
                                      > and we're around most of the interoperability issues now. Is it
                                      easy for a
                                      > SOAP::Lite server to handle named parameters, and if so how do I
                                      approach
                                      > the problem?
                                      >
                                      > Thanks,
                                      > Chris
                                      > --
                                      > Chris Davies, Manheim Interactive (Europe)
                                      > Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@M...
                                    • One4K4
                                      FYI: You need: package Foo; @Foo::ISA = SOAP::Server::Parameters ; At the top of your package declration. *If* you re dynamically/non- statically
                                      Message 18 of 26 , Jun 13, 2002
                                        FYI: You need:

                                        package Foo;
                                        @Foo::ISA = 'SOAP::Server::Parameters';

                                        At the top of your package declration. *If* you're dynamically/non-
                                        statically dispatching.

                                        -Tom

                                        --- In soaplite@y..., "One4K4" <one4k4@y...> wrote:
                                        > From the SOAP::Lite pod docs:
                                        > ------------------------------------------------------
                                        > Every method on server side will be called as class/object method,
                                        so
                                        > it will get an object reference or a class name as the first
                                        > parameter, then the method parameters, and then an envelope as
                                        > SOAP::SOM object. Shortly:
                                        >
                                        > $self [, @parameters] , $envelope
                                        >
                                        > If you have a fixed number of parameters, you can do:
                                        >
                                        > my $self = shift;
                                        > my($param1, $param2) = @_;
                                        >
                                        > and ignore the envelope. If you need access to the envelope you can
                                        > do:
                                        >
                                        > my $envelope = pop;
                                        >
                                        > since the envelope is always the last element in the parameters
                                        list.
                                        > The byname() method pop->method will return a hash with parameter
                                        > names as hash keys and parameter values as hash values:
                                        >
                                        > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                        >
                                        > gives you by-name access to your parameters.
                                        > ------------------------------------------------------
                                        >
                                        > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                        > I've tried that... but for some reason there is *no envelope* at
                                        the
                                        > end of @_ ?!
                                        >
                                        > -Tom
                                        >
                                        >
                                        > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                        > > I'm using a SOAP::Lite server with version 0.46 of SOAP::Lite.
                                        > >
                                        > > My colleagues in a.n.other company want to use named parameters
                                        > (rather than
                                        > > positional ones) to talk to my SOAP::Lite server. They are using
                                        > MS .NET,
                                        > > and we're around most of the interoperability issues now. Is it
                                        > easy for a
                                        > > SOAP::Lite server to handle named parameters, and if so how do I
                                        > approach
                                        > > the problem?
                                        > >
                                        > > Thanks,
                                        > > Chris
                                        > > --
                                        > > Chris Davies, Manheim Interactive (Europe)
                                        > > Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@M...
                                      • Keanan Smith
                                        You will get this functionality ONLY if you inherit your class from the SOAP::Server::Parameters class. This should keep existing code working and provides
                                        Message 19 of 26 , Jun 13, 2002
                                          "You will get this functionality ONLY if you inherit your class from the
                                          SOAP::Server::Parameters class. This should keep existing code working and
                                          provides this feature only when you need it."

                                          I think this may be what you are looking for...

                                          -----Original Message-----
                                          From: One4K4 [mailto:one4k4@...]
                                          Sent: Thursday, June 13, 2002 8:51 AM
                                          To: soaplite@yahoogroups.com
                                          Subject: [soaplite] Re: Can the server process parameters by name?


                                          From the SOAP::Lite pod docs:
                                          ------------------------------------------------------
                                          Every method on server side will be called as class/object method, so
                                          it will get an object reference or a class name as the first
                                          parameter, then the method parameters, and then an envelope as
                                          SOAP::SOM object. Shortly:

                                          $self [, @parameters] , $envelope

                                          If you have a fixed number of parameters, you can do:

                                          my $self = shift;
                                          my($param1, $param2) = @_;

                                          and ignore the envelope. If you need access to the envelope you can
                                          do:

                                          my $envelope = pop;

                                          since the envelope is always the last element in the parameters list.
                                          The byname() method pop->method will return a hash with parameter
                                          names as hash keys and parameter values as hash values:

                                          my($a, $b, $c) = @{pop->method}{qw(a b c)};

                                          gives you by-name access to your parameters.
                                          ------------------------------------------------------

                                          my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                          I've tried that... but for some reason there is *no envelope* at the
                                          end of @_ ?!

                                          -Tom


                                          --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                          > I'm using a SOAP::Lite server with version 0.46 of SOAP::Lite.
                                          >
                                          > My colleagues in a.n.other company want to use named parameters
                                          (rather than
                                          > positional ones) to talk to my SOAP::Lite server. They are using
                                          MS .NET,
                                          > and we're around most of the interoperability issues now. Is it
                                          easy for a
                                          > SOAP::Lite server to handle named parameters, and if so how do I
                                          approach
                                          > the problem?
                                          >
                                          > Thanks,
                                          > Chris
                                          > --
                                          > Chris Davies, Manheim Interactive (Europe)
                                          > Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@M...



                                          To unsubscribe from this group, send an email to:
                                          soaplite-unsubscribe@yahoogroups.com



                                          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                                        • One4K4
                                          Yeap, that did it... consider: package DocPub; @DocPub::ISA = SOAP::Server::Parameters ; Which solved my problem, using the pod doc s code sample. Thanks!
                                          Message 20 of 26 , Jun 13, 2002
                                            Yeap, that did it... consider:

                                            package DocPub;
                                            @DocPub::ISA = 'SOAP::Server::Parameters';

                                            Which solved my problem, using the pod doc's code sample.

                                            Thanks!

                                            -Tom

                                            --- In soaplite@y..., Keanan Smith <KSmith@n...> wrote:
                                            > "You will get this functionality ONLY if you inherit your class
                                            from the
                                            > SOAP::Server::Parameters class. This should keep existing code
                                            working and
                                            > provides this feature only when you need it."
                                            >
                                            > I think this may be what you are looking for...
                                            >
                                            > -----Original Message-----
                                            > From: One4K4 [mailto:one4k4@y...]
                                            > Sent: Thursday, June 13, 2002 8:51 AM
                                            > To: soaplite@y...
                                            > Subject: [soaplite] Re: Can the server process parameters by name?
                                            >
                                            >
                                            > From the SOAP::Lite pod docs:
                                            > ------------------------------------------------------
                                            > Every method on server side will be called as class/object method,
                                            so
                                            > it will get an object reference or a class name as the first
                                            > parameter, then the method parameters, and then an envelope as
                                            > SOAP::SOM object. Shortly:
                                            >
                                            > $self [, @parameters] , $envelope
                                            >
                                            > If you have a fixed number of parameters, you can do:
                                            >
                                            > my $self = shift;
                                            > my($param1, $param2) = @_;
                                            >
                                            > and ignore the envelope. If you need access to the envelope you can
                                            > do:
                                            >
                                            > my $envelope = pop;
                                            >
                                            > since the envelope is always the last element in the parameters
                                            list.
                                            > The byname() method pop->method will return a hash with parameter
                                            > names as hash keys and parameter values as hash values:
                                            >
                                            > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                            >
                                            > gives you by-name access to your parameters.
                                            > ------------------------------------------------------
                                            >
                                            > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                            > I've tried that... but for some reason there is *no envelope* at
                                            the
                                            > end of @_ ?!
                                            >
                                            > -Tom
                                            >
                                            >
                                            > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                            > > I'm using a SOAP::Lite server with version 0.46 of SOAP::Lite.
                                            > >
                                            > > My colleagues in a.n.other company want to use named parameters
                                            > (rather than
                                            > > positional ones) to talk to my SOAP::Lite server. They are using
                                            > MS .NET,
                                            > > and we're around most of the interoperability issues now. Is it
                                            > easy for a
                                            > > SOAP::Lite server to handle named parameters, and if so how do I
                                            > approach
                                            > > the problem?
                                            > >
                                            > > Thanks,
                                            > > Chris
                                            > > --
                                            > > Chris Davies, Manheim Interactive (Europe)
                                            > > Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@M...
                                            >
                                            >
                                            >
                                            > To unsubscribe from this group, send an email to:
                                            > soaplite-unsubscribe@y...
                                            >
                                            >
                                            >
                                            > Your use of Yahoo! Groups is subject to
                                            http://docs.yahoo.com/info/terms/
                                          • Paul Kulchenko
                                            Hi, Tom! There are also byName and byNameOrOrder functions (Randy Ray made a great suggestion to make them methods instead of functions) in
                                            Message 21 of 26 , Jun 13, 2002
                                              Hi, Tom!

                                              There are also byName and byNameOrOrder functions (Randy Ray made a
                                              great suggestion to make them methods instead of functions) in
                                              SOAP::Server::Parameters class that allow you to do this:

                                              my $self = shift;
                                              my($a, $b, $c) = SOAP::Server::Parameters::byName([qw(a b c)], @_);

                                              Take a look at \examples\My\Parameters.pm for more details.

                                              Best wishes, Paul.

                                              --- One4K4 <one4k4@...> wrote:
                                              > Yeap, that did it... consider:
                                              >
                                              > package DocPub;
                                              > @DocPub::ISA = 'SOAP::Server::Parameters';
                                              >
                                              > Which solved my problem, using the pod doc's code sample.
                                              >
                                              > Thanks!
                                              >
                                              > -Tom
                                              >
                                              > --- In soaplite@y..., Keanan Smith <KSmith@n...> wrote:
                                              > > "You will get this functionality ONLY if you inherit your class
                                              > from the
                                              > > SOAP::Server::Parameters class. This should keep existing code
                                              > working and
                                              > > provides this feature only when you need it."
                                              > >
                                              > > I think this may be what you are looking for...
                                              > >
                                              > > -----Original Message-----
                                              > > From: One4K4 [mailto:one4k4@y...]
                                              > > Sent: Thursday, June 13, 2002 8:51 AM
                                              > > To: soaplite@y...
                                              > > Subject: [soaplite] Re: Can the server process parameters by
                                              > name?
                                              > >
                                              > >
                                              > > From the SOAP::Lite pod docs:
                                              > > ------------------------------------------------------
                                              > > Every method on server side will be called as class/object
                                              > method,
                                              > so
                                              > > it will get an object reference or a class name as the first
                                              > > parameter, then the method parameters, and then an envelope as
                                              > > SOAP::SOM object. Shortly:
                                              > >
                                              > > $self [, @parameters] , $envelope
                                              > >
                                              > > If you have a fixed number of parameters, you can do:
                                              > >
                                              > > my $self = shift;
                                              > > my($param1, $param2) = @_;
                                              > >
                                              > > and ignore the envelope. If you need access to the envelope you
                                              > can
                                              > > do:
                                              > >
                                              > > my $envelope = pop;
                                              > >
                                              > > since the envelope is always the last element in the parameters
                                              > list.
                                              > > The byname() method pop->method will return a hash with parameter
                                              >
                                              > > names as hash keys and parameter values as hash values:
                                              > >
                                              > > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                              > >
                                              > > gives you by-name access to your parameters.
                                              > > ------------------------------------------------------
                                              > >
                                              > > my($a, $b, $c) = @{pop->method}{qw(a b c)};
                                              > > I've tried that... but for some reason there is *no envelope* at
                                              > the
                                              > > end of @_ ?!
                                              > >
                                              > > -Tom
                                              > >
                                              > >
                                              > > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                                              > > > I'm using a SOAP::Lite server with version 0.46 of SOAP::Lite.
                                              > > >
                                              > > > My colleagues in a.n.other company want to use named parameters
                                              >
                                              > > (rather than
                                              > > > positional ones) to talk to my SOAP::Lite server. They are
                                              > using
                                              > > MS .NET,
                                              > > > and we're around most of the interoperability issues now. Is it
                                              >
                                              > > easy for a
                                              > > > SOAP::Lite server to handle named parameters, and if so how do
                                              > I
                                              > > approach
                                              > > > the problem?
                                              > > >
                                              > > > Thanks,
                                              > > > Chris
                                              > > > --
                                              > > > Chris Davies, Manheim Interactive (Europe)
                                              > > > Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@M...
                                              > >
                                              > >
                                              > >
                                              > > To unsubscribe from this group, send an email to:
                                              > > soaplite-unsubscribe@y...
                                              > >
                                              > >
                                              > >
                                              > > Your use of Yahoo! Groups is subject to
                                              > http://docs.yahoo.com/info/terms/
                                              >
                                              >
                                              > ------------------------ Yahoo! Groups Sponsor
                                              >
                                              > To unsubscribe from this group, send an email to:
                                              > soaplite-unsubscribe@yahoogroups.com
                                              >
                                              >
                                              >
                                              > Your use of Yahoo! Groups is subject to
                                              > http://docs.yahoo.com/info/terms/
                                              >
                                              >


                                              __________________________________________________
                                              Do You Yahoo!?
                                              Yahoo! - Official partner of 2002 FIFA World Cup
                                              http://fifaworldcup.yahoo.com
                                            Your message has been successfully submitted and would be delivered to recipients shortly.