How to call perl web service from javascript?

Hi,

I would like to call the below perl web service from javascript .Any help would be appreciated.I am new to web services.Please do the needful.

[b][u]Server Program(Perl Web Service)

#!/usr/bin/perl
use lib '/usr/lib/perl5/5.8.8/SOAP-Lite-0.65_3/lib';
use SOAP::Transport::HTTP;
use Demo;
  SOAP::Transport::HTTP::CGI
    -> dispatch_to('Demo')
    -> handle;

[b][u]Demo.pm program

#!/usr/bin/perl
package Demo;
  sub hi {
    return "hello, world";
  }
  sub bye {
    return "goodbye, cruel world";
  }
1;

Thanks,
Liyakath.

I suppose you have to know if it is a GET or POST CGI web service, the URL, fi encrypted https, the variable names, the input and possible output mime types, so you can construct a correct URL and HTTP POST input section and are ready for the response message. JAVASCRIPT to get a text resource from a URL should be in tutorials all over.

Hi,

Can you please provide me sample javascript client code to access the below server side code:

#!/usr/bin/perl
use lib '/usr/lib/perl5/5.8.8/SOAP-Lite-0.65_3/lib';
use SOAP::Transport::HTTP;
use Demo;
  SOAP::Transport::HTTP::CGI
    -> dispatch_to('Demo')
    -> handle;

Thanks,
liyakath.

---------- Post updated at 07:17 AM ---------- Previous update was at 04:32 AM ----------

hi,

When I execute the below server side perl program I am getting HTTP status 411: Length Required Error.

#!/usr/bin/perl
use lib '/usr/lib/perl5/5.8.8/SOAP-Lite-0.65_3/lib';
use SOAP::Transport::HTTP;
use Demo;
  SOAP::Transport::HTTP::CGI
    -> dispatch_to('Demo')
    -> handle;

Do i need to make any change in the above program?Any help would be appreciated.

Thanks,
Liyakath.

This service demands a "Content-Length: #" in the http header you send after the GET/POST. The creator of the post-header payload should measure it ahead of time and generate this header line. That is in the fine; in the gross, it seems this is common running the script on the command line not on the server:

http://www.perlmonks.org/?node_id=584526