vi_srikanth has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am trying to set up a web service in Perl. This should provide a function for clients to upload their files. I am new to web services. To start with, I have created a simple web service which will add two numbers. Here is the server side code:
use Frontier::RPC2; my $rpc = new Frontier::RPC2; my $methods = {'sum' => \&sum}; sub sum { my ($arg1, $arg2) = @_; return $arg1 + $arg2; } print "Content-type: text/xml\n\n"; my $buffer = ""; # Reads the request in from STDIN up to CONTENT_LENGTH if (defined $ENV{"REQUEST_METHOD"} && $ENV{"REQUEST_METHOD"} eq 'POST' +) { if (exists($ENV{"CONTENT_TYPE"}) && $ENV{"CONTENT_TYPE"} eq 't +ext/xml' ) { read(STDIN, $buffer, $ENV{"CONTENT_LENGTH"}); } } my $responce = $rpc->serve($buffer, $methods); print $responce . "\n";
And here is the client side code:
use Frontier::Client; my $url = "http://192.168.1.207/cgi-bin/ws.pl"; my @args = (5, 2); my $client = new Frontier::Client( url => $url, debug => 0); print $client->call('sum', @args);
Please let me know how I should go about for providing an upload function. If there is also any URL from which I can get to know this information kindly let me know.
Thanks
Srikanth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Web services - Upload
by osunderdog (Deacon) on Oct 19, 2006 at 07:42 UTC | |
by vi_srikanth (Acolyte) on Oct 19, 2006 at 08:31 UTC | |
by osunderdog (Deacon) on Oct 19, 2006 at 13:09 UTC | |
by vi_srikanth (Acolyte) on Oct 20, 2006 at 12:05 UTC | |
|
Re: Web services - Upload
by neilwatson (Priest) on Oct 19, 2006 at 15:44 UTC |