svanapall has asked for the wisdom of the Perl Monks concerning the following question:
need to call server from the client using soap
i hv a hello1.pm in lib folder saved under cgi-bin code as
#!c:\perl\bin\perl.exe # hello1.pm - simple Hello module use strict; sub sayHello { shift; return "Hello " . shift; } 1;
I hv a hello.cgi saved under cgi-bin code as follows
#!c:\perl\bin\perl.exe use lib 'hello1.pm'; # hello.cgi - Hello SOAP handler print "Content-Type: text/html\n\n"; #my $length = $ENV{'CONTENT_LENGTH'}; #print $length; #print "hello world"; use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI -> dispatch_to('hello1::(?:sayHello)') -> handle ;
i hv a helloclient.pl saved under cgi-bin code as follows
#!c:\perl\bin\perl.exe # hw_client.pl - Hello client use SOAP::Lite; #use cgi; use hello1; #my $cgi_in; #my $cgi = new CGI ; #$cgi_in = sayHello($cgi); #print "Content-Type: text/html\n\n"; #print "Content- Length: 66"; my $name = shift; #print "$name"; print "\n\nCalling the SOAP Server to say hello\n\n"; print "The SOAP Server says: "; print SOAP::Lite -> uri('urn:hello') -> proxy('http://localhost/cgi-bin/hello.cgi') -> sayHello($name) -> result ; print "welcome";
when i run the client program as
perl helloclient.pl lathaoutput must be like
nCalling the SOAP Server to say hello The SOAP Server says: Hello latha welcome
but helloclient program fails to call the hello.cgi
when i compile hello.cgi it is showing an error that status:411 Lenth Required
pls help to solve this
Thanks in advance
latha
Edited by planetscape - added rudimentary formatting, moved text out of code tags
|
|---|