On Mon, Apr 15, 2002 at 04:09:12PM +0800, Orlando Andico wrote:
> 
> (I'm CC'ing this to PLUG because ph-perl gets so little traffic; another 
> example of why I think Oracle questions should go to PLUG instead of 
> another low-traffic list)
> 
> Doing function calls with SOAP is nice with the auto-namespace generator, 
> but for some reason I need to give the return values NAMES.
> 
> e.g. in a return (my function returns several values)
> 
>         return (
>                 SOAP::Data->name("valid" => "N"),
>                 SOAP::Data->name("trx_no" => 0),
>                 SOAP::Data->name("approval_code" => 0),
>                 SOAP::Data->name("invoice_num" => 0),
>                 SOAP::Data->name("ref_num" => 0),
>                 SOAP::Data->name("tr_date" => $tr_date),
>                 SOAP::Data->name("message" => $msg)
>         );
> 
> in the function call (I'm not sure if this works because of naming, or 
> solely because it's in the right order) (note: don't get too excited by 
> the credit card number, it's an invalid number which happens to pass the 
> check digit):
> 
> $s = SOAP::Lite
>         -> uri ("foo")
>         -> proxy ("https://foo.foo.foo";)
>         -> validate_cc(
>                 SOAP::Data->name("cartno" => 9999999999),
>                 SOAP::Data->name("clientcode" => 9999999999),
>                 SOAP::Data->name("amount" => 9.95),
>                 SOAP::Data->name("description" => "test payment"),
>                 SOAP::Data->name("currency" => "P"),
>                 SOAP::Data->name("crcno" => "5276 4400 6542 1319"),
>                 SOAP::Data->name("expiry" => "1203")
>         );
> 
> 
> anyway, in the dispatch function, instead of fetching the variables by 
> order; e.g. instead of this..
> 
> sub validate_cc {
>        # function parameters
>        my (undef, $cartno, $clientcode, $amount, $particulars, $currency,
>                $crcno, $expiry) = @_;
> ..
> 
> I want something like this:
> 
> sub validate_cc {
>         # function parameters
>         my $cartno = SOAP::Data->name("cartno")->value();
>         my $clientcode = SOAP::Data->name("clientcode");
>         my $amount = SOAP::Data->name("amount");
>         my $particulars = SOAP::Data->name("description");
>         my $currency = SOAP::Data->name("currency");
>         my $crcno = SOAP::Data->name("crcno");
>         my $expiry = SOAP::Data->name("expiry");
> ..
> 
> 
> but the above doesn't work (it returns hashes, crikey).
> 
> brainwaves? suggestions?
> 

Try this...

# --- BEGIN foo.pm 
package foo;

@ISA = qw(SOAP::Server::Parameters); # to get envelope

sub validate_cc {
  my $self=shift;
  my $envelope = pop;

  my $cartno = $envelope->valueof("//validate_cc/cartno");
  my $clientcode = $envelope->valueof("//validate_cc/clientcode");
  my $amount = $envelope->valueof("//validate_cc/amount");
  my $description = $envelope->valueof("//validate_cc/description");
  my $currency = $envelope->valueof("//validate_cc/currency");
  my $crcno = $envelope->valueof("//validate_cc/crcno");
  my $expiry = $envelope->valueof("//validate_cc/expiry");
}

1;
# --- END foo.pm

Hope this helps.
-- 
$_=q:; # SHERWIN #
70;72;69;6e;74;20;
27;4a;75;73;74;20;
61;6e;6f;74;68;65;
72;20;50;65;72;6c;
20;6e;6f;76;69;63;
65;27;:;;s=~?(..);
?=pack q$C$,hex$1;
;;;=egg;;;;eval;;;
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to