Re: [SOAP] How to send Hash from PHP to Perl using Soap::Lite
| From: | Sukumar .S | Date: | Tue, 08 Oct 2002 06:28:44 +0000 |
| Subject: | Re: [SOAP] How to send Hash from PHP to Perl using Soap::Lite | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-283@lists.php.net to get a copy of this message | ||
Hi,
Thanks and i got the point on how to send the hash and ref to hash from
PHP to Perl.
When i send the array(array) from php, in perl i can able to get it has
ref to hash.
Clarify me, if anything wrong in my understanding. Now the revised code
looks like this.
with Regards,
S. Sukumar
Perl Code
---------
package Hello;
use Data::Dumper;
sub Hash_Ref
{
my ($Class,$Info) = @_;
#print Dumper %Info;
my $Key = "";
my $Data = "";
foreach $Key (keys %$Info)
{
$Data .= $Key . "=" . $Info->{$Key} . ";";
}
return "class is $Class Received the User Information $Data";
}
sub Hash_NoRef
{
my ($Class,%Info) = @_;
my $Key = "";
my $Data = "";
foreach $Key (keys %Info)
{
$Data .= $Key . "=" . $Info{$Key} . ";";
}
return "class is $Class Received the User Information $Data";
}
1;
PHP Code.
--------
<?php
include("SOAP/Client.php");
$HashRef = array(
'NAME' => "S. Sukumar",
'GROUP' => "Administrator",
);
$S = new
SOAP_Client("http://sukumar.bksys.co.in/cgi-bin/Hello.pl");
$Result = $S->Call("Hash_Ref",array($HashRef),"urn:Hello");
print_r($Result);
print "\n";
$Result = $S->Call("Hash_NoRef",array($HashRef),"urn:Hello");
print_r($Result);
print "\n";
?>
> The second parameter to call is expected to be an array of arguments, so
> you need to do something like:
>
> $userinfo = array (
> 'USER_NAME' => "S. Sukumar",
> 'GROUP_NAME' => "Administrator"
> );
> $Result = $S->Call("User_Info",array($userinfo),"urn:Hello");
>
>
>