[Ilugc] WebService in Perl

  • From: girish1729@xxxxxxxxx (Girish Venkatachalam)
  • Date: Tue Aug 22 17:40:36 2006



--- Venkatraman S <blizzard_venkat@xxxxxxxxxxx> wrote:

        Hi,
 
 I am trying to create a small webservice using
Perl. 
 
 I have 2 files : temp.pl and temper.cgi ( as
specified in
http://www.perl.com/pub/a/2001/01/soap.html).  When
i try calling ,  "$ perl temp.pl" , i am getting the
following an error after a gap of around 3-4
minutes: 500 Can't connect to abc:80 (connect:
timeout) at temp.pl line 6
 
 Has anyone any previous experience with creating
Web-Services using Perl?
 
 Regards,
Venkat
 
 $ cat temp.pl
 #! /usr/local/bin/perl
 BEGIN {push
@INC,"/home/xxx/yyy/SOAP/install/lib/5.8.1";}
 
 use SOAP::Lite;
 
   print SOAP::Lite
     ->

uri('http://abc/cgi-bin/pqr/venky_temp/Temperatures')
     ->

proxy('http://abc/cgi-bin/pqr/venky_temp/temper.cgi')
     -> c2f(37.5)
     -> result;
 
 $ cat temper.cgi
 #! /usr/local/bin/perl
 BEGIN {push
@INC,"/home/xxx/yyy/SOAP/install/lib/5.8.1";}
 
 use SOAP::Transport::HTTP;
 
   SOAP::Transport::HTTP::CGI
     -> dispatch_to('Temperatures')
     -> handle;
 
   package Temperatures;
 
   sub f2c {
       my ($class, $f) = @_;
       return 5 / 9 * ($f - 32);
   }
 
   sub c2f {
       my ($class, $c) = @_;
       return 32 + $c * 9 / 5;
   }
abc shud be substituted with the name of the SOAP
server to connect to. i.e., 

print SOAP::Lite>      ->
 uri('http://abc/cgi-bin/pqr/venky_temp/Temperatures')
      ->
 proxy('http://abc/cgi-bin/pqr/venky_temp/temper.cgi')
      -> c2f(37.5)
      -> result;

should read

print SOAP::Lite>      ->

uri('http://www.perl.com/cgi-bin/pqr/venky_temp/Temperatures')
      ->
 proxy('http://abc/cgi-bin/pqr/venky_temp/temper.cgi')
      -> c2f(37.5)
      -> result;  

Of course if you have a proxy you should change that
as well or just leave it out.

HTH,
Girish
PS:- In this case I have used www.perl.com, you should
use your SOAP server.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com ;

Other related posts: