vebram has asked for the wisdom of the Perl Monks concerning the following question:

hi I am very new to Perl and am trying to teach myself through text books and online sites. I am a windows user and am concentrating on the use of perl in web services for a course I am doing. I only need a basic overview for the course but I really want to understand it. My question is probably very basic but here goes: I want to write a web services requestor script in perl that references a module and calls a method that requires two input values. My attempts have not succeeded and I cannot find anywhere that gives guidance on perl for web services specifically. I have done tutorials on perl but no one seems to touch the web services angle (that I have been able to find)and so I cannot write the code for a requestor to invoke a method. can someone please point me to a book, article or site that I can read. thanks vebram
  • Comment on Looking For Web-Services and Perl References

Replies are listed 'Best First'.
Re: Looking For Web-Services and Perl References
by weismat (Friar) on Oct 28, 2007 at 17:00 UTC
    You should be more specific in what you have tried and post the code which you have tried.
    I would suggest that you look at the soap::lite module SOAP::Lite.
    There are a few web sites which you could look at:
    Soap Client Tutorial contains a small example.
    The Soap Lite project page contains more details about soap lite.
      Thank you for the link to the Perl Client Tutorial, that helped me a lot. I did not want anyone to do 'homeowrk' for me and if I was vague it is because I am very new and struggling. Thanks for the help.
Re: Looking For Web-Services and Perl References
by tuxz0r (Pilgrim) on Oct 28, 2007 at 18:06 UTC
    A good book that I got (back in the day) was Programming Web Services with Perl (O'Reily). Here's the link to the site for the book which has code samples, errata and more resources. You might give that a try, too.

    ---
    echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'

Re: Looking For Web-Services and Perl References
by GrandFather (Saint) on Oct 28, 2007 at 19:54 UTC

    Why do do want to perform that particular feat in that particular (but poorly defined) way? It almost sounds like something that might be set for homework. Show us the code you are having trouble with and tell us, or better still show us, where you are having trouble.


    Perl is environmentally friendly - it saves trees
Re: Looking For Web-Services and Perl References
by trwww (Priest) on Oct 29, 2007 at 09:21 UTC

    Hello,

    GrandFather is right, you should show us what you've done so far. Also, Please choose a descriptive subject for your node.

    Regarding the code, its really pretty easy. Observe:

    On machine A:

    $ cat server.pl use warnings; use strict; use RPC::XML::Server; my $server = RPC::XML::Server->new(port => 9000); $server->add_method({ name => 'test.hello', signature => [ q|string string| ], help => 'this method greets an argument... cool, huh?', code => sub { my($server, $str) = @_; return( "Hello, $str!" ); } }); print "listening on port 9000\n"; $server->server_loop; [trwww@waveright rpc]$ perl server.pl listening on port 9000

    On Machine X:

    $ XMLRPCsh.pl http://localhost:9000/ Usage: method[(parameters)] > system.listMethods('test') --- XMLRPC RESULT --- [ 'test.hello' ] > system.methodHelp('test.hello') --- XMLRPC RESULT --- 'this method greets an argument... cool, huh?' > system.methodSignature('test.hello') --- XMLRPC RESULT --- [ [ 'string', 'string' ] ] > test.hello('perlmonks') --- XMLRPC RESULT --- 'Hello, perlmonks!' >

    regards,

    trwww

Re: Looking For Web-Services and Perl References
by weierophinney (Pilgrim) on Oct 30, 2007 at 13:29 UTC
    You're being overly vague in your question. What kind of web service are you trying to request -- XML-RPC, SOAP, REST, ATOM? Is the service operating over HTTP or on a socket? Does it require any sort of authentication or API key? If so, do you have credentials? You're not likely to get any sort of meaningful answer until you can address the above questions.