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
In reply to Web services - Upload by vi_srikanth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |