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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.