You are here iC Home > Perl > SOAP > SOAP Array

Perl

5.3.3 SOAP Array

20.11.2008
5.3.2 SOAP Basic Authorization [  up  ] - [ a - z ] - [ search PC ] - [ top ] 5.3.4 Google SOAP

5.1   RSS 2.0
5.2   XML RPC
 5.2.1  XML::Parser
5.3   SOAP
 5.3.1  SOAP Error Handling
 5.3.2  SOAP Basic Authorization
 5.3.3  SOAP Array
 5.3.4  Google SOAP
 5.3.5  SOAP Examples
5.4   eBay API
 5.4.1  Example: get Ebay Time

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


Advanced search tips
5.3.2 SOAP Basic Authorization [  up  ] - [ top ] 5.3.4 Google SOAP



[ home ] - [ search ] - [ feedback ]

copyright by reto - created with mytexi