#======================================
# auto dispatching client - 2007.5.3 - jkryu
# 이 것은 클라이언트
print "==============\n";
print "auto dispatching \n";
use SOAP::Lite +autodispatch =>
uri => 'http://host/Demo',
proxy => 'http://host/service/service.cgi';
# array passing simple case
# 2007.5.7
@a = ("aa", "bb", "cc", "dd", "ee");
my $obj = Demo->new(90);
$result = $obj->hi( @a );
print $result;
#======================================
# auto dispatching server - 2007.5.3 - jkryu
# 서버
#!/usr/bin/perl -w
use SOAP::Transport::HTTP;
use Demo;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Demo')
-> handle;
#======================================
# auto dispatching server - 2007.5.3 - jkryu
#
package Demo;
sub hi {
my ($class, @a) = @_;
my $result;
for ( $i=0; $i <= $#a; $i++ )
{
$result .= "hi " . $a[$i] . "\n";
}
# return "HI $a \n";
return $result;
}
#===============================
# object Acess
#
sub new {
my $self = shift;
my $class = ref($self) || $self;
bless {_temperature => shift} => $class;
}
----------- 결과 ---------------
$ perl client.pl
hi 123
==============
auto dispatching
hi aa
hi bb
hi cc
hi dd
hi ee
댓글 없음:
댓글 쓰기