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

Hi,

my requirment is too call a web service using perl into one of my clients webservice which is build in jason(i guess). all the information i got is the url to acess ($URL="http://testgenes.com/servlet/sync?) and i have to Pass some information to its such as($data="pid=12&name=test"); this will update some tables @their background( i have no info on that) and in return it will send some text as out put.
more over the perl script will be executed in command line part of an internal pipeline

I tried to go through soap and LWP for the same but with the limited information in my hand such as above i could'n get it right

Code:1 use LWP::UserAgent; my $input ="pid=12&name=test"; my $ua = LWP::UserAgent->new; $ua->agent("apple"); my $req = HTTP::Request->new(POST => http://test.com/servlet/sync?'); $req->content_type('text/html'); $req->content("$input"); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; } ####################################### Code:2 use SOAP::Lite; my $soap = SOAP::Lite->new( proxy => 'http://test.com/servlet/sync?'); my $som = $soap->call('sayHello', SOAP::Data->name('pid')->value('12'), SOAP::Data->name('name')->value('test') ); die $som->faultstring if ($som->fault); print $som->result, "\n";

none of the code worked..Please find me the simplest ay to do the same and also a referral which gives info in a simple sentences

Replies are listed 'Best First'.
Re: call web service
by kcott (Archbishop) on Apr 16, 2013 at 12:59 UTC

    G'day vinumanikandan,

    "none of the code worked" is completely unhelpful! Were there error messages or other output? Please read these guidelines: How do I post a question effectively?

    Using strict and warnings will often help you to track down problems. I would recommend that you get into the habit of using these always (unless you have a very good reason not to).

    One line where I see an obvious problem (missing quote):

    my $req = HTTP::Request->new(POST => http://test.com/servlet/sync?');

    -- Ken

Re: call web service (documentation)
by Anonymous Monk on Apr 16, 2013 at 09:52 UTC
    Where is documentation for this "web service"?
      sorry i didnt get you