Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Web services - Upload

by osunderdog (Deacon)
on Oct 19, 2006 at 07:42 UTC ( #579295=note: print w/replies, xml ) Need Help??


in reply to Web services - Upload

I haven't ever played with Frontier. But thought I would give it a whirl. It appears to work as advertised...

Server

#!/usr/bin/perl # sum() server use strict; use warnings; use Frontier::Daemon; my $d = Frontier::Daemon->new( methods => { sum => \&sum, }, LocalAddr => '10.0.1.2', LocalPort => 1080, ); sub sum { my ($arg1, $arg2) = @_; return $arg1 + $arg2; }

Client

#!/usr/bin/perl # Testing sum() use strict; use warnings; use Frontier::Client; my $url = "http://10.0.1.2:1080/RPC2"; my @args = (2,5); my $client = Frontier::Client->new( url => $url, debug => 0, ); print "$args[0] + $args[1] = ", $client->call('sum', @args), "\n";

Output

$perl Client.pl 2 + 5 = 7

Architecture?

Perhaps if you could explain a little about the architecture that you're shooting for, it would help us discern what would be the best approach for you to accomplish your goal. Are you, perhaps, interested in something that would work from a web server as a cgi?

Hazah! I'm quitting!

$g = "FSF SUCKS"; $g =~ s/F/C/g; print $g;

Replies are listed 'Best First'.
Re^2: Web services - Upload
by vi_srikanth (Acolyte) on Oct 19, 2006 at 08:31 UTC

    Hi osunderdog

    Here is the purpose: The client will upload files to the server. But he will not do that through a web brouwer. Instead he will use the methods provided by my server-web-services in his program. I think CGI is not a right choice for this. Currently the client program will be in perl, but in future it can be anything. Any idea how to go about from here?

    Thanks
    Srikanth

      More information is certainly better than less. ;)

      What will happen to the file once it is received by the server... Some further processing? Stored off for another application to pickup?

      I guess I'm trying to avoid telling you to build a server to receive the file, because those already exist. You could use ssh or ftp or something to receive the file using an already existing protocol. Just off the top of my head (and not to be mistaken for actual experience with this approach) I would have the client connect to the server... upon receiving a command from the client, the server would fire up ftp Net::FTPServer configured to accept connections on an agreed upon port. The client would then invoke ftp to connect to the agreed upon port. The client would transmit the file to the server. The client closes the ftp connection... the server takes back control after the ftp server indicates it has received the file or shutsdown.

      In fact, after looking at Net::FTPServer, it may be something that you could extend to do exactly what you need...

      Just some pseudo-random thoughts.

      Hazah! I'm Employed!

        I hav ordered the book "Programming Web Services with Perl". Let me see whether I get any ideas about this problem there.

        osunderdog, thank for the suggestion. This is just a start of what my customer request. All he asks now is give me a webservice by which I can upload file and send in some data. He might add something in future. All I want to do is just create a webservice that would enable file uploads. Anyway thanks again for the suggestion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://579295]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2020-11-26 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?