cgi-bin/server.cgi:
#!/usr/bin/env perl
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
->dispatch_to('/home/michael/localhost/lib', 'Demo')
->handle;
lib/Demo.pm:
package Demo;
sub hi {
return 'Hello, world';
}
sub bye {
return 'Goodbye, cruel world';
}
1;
somewhere/client.pl:
#!/usr/bin/env perl
use SOAP::Lite;
my $hi = SOAP::Lite
->uri('http://localhost/Demo')
->proxy('http://localhost/cgi-bin/server.cgi')
->hi()
->result();
print "hi: [$hi]\n";
my $bye = SOAP::Lite
->uri('http://localhost/Demo')
->proxy('http://localhost/cgi-bin/server.cgi')
->bye()
->result();
print "bye: [$bye]\n";
No comments:
Post a Comment