Client
[ → files/soap/client soap array pl.txt ]
#!/usr/bin/perl -w
# -- Client
use SOAP::Lite;
print "Content-type: text/html\n\n";
my @arr = qw(100 foo 101 bar 102 more);
my $result = SOAP::Lite
-> uri('http://sunri1.example.net/HelloSOAPArray')
# -> proxy('http://localhost:7890')
-> proxy('http://sunri1.example.net/cgi-bin/soap/server_soap_array.cgi')
-> doFuncFoo(1000, 'Hans', 'Muster', \@arr)
-> result;
print "<h3>Result is:</h3>\n";
foreach (@{$result}) {
print "- $_<br>\n";
}
Server
[ → files/soap/server soap array cgi.txt ]
#!/usr/bin/perl -w
use strict;
# -- Server
# -- SOAP::Lite
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('HelloSOAPArray')
-> handle;
package HelloSOAPArray;
sub doFuncFoo(%) {
my ($class, $id, $first, $last, $in_arr) = @_;
my $res = "ID: $id / $first $last ";
foreach (@{$in_arr}) {
$res .= "[$_] ";
}
my @arr = qw();
$arr[0] = 200;
$arr[1] = $res;
return \@arr;
}
__END__
Failed to access class (HelloSOAP): Can't locate HelloSOAP.pm in @INC (@INC contains:) at (eval 93) line 3.
See also:
/know how/php/soap weather