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


in reply to Soap::Lite and IIS problems

Modifying your code to run on my machine, I have
serv.pl #!/usr/bin/perl -- use strict; use warnings; use SOAP::Transport::HTTP; my $daemon = SOAP::Transport::HTTP::Daemon->new( LocalAddr => '127.0.0.1', LocalPort => 1203, Reuse => 1 )->dispatch_to('Demo'); print "Contact to SOAP server at ", $daemon->url, "\n"; $daemon->handle; #~ SOAP::Transport::HTTP::CGI #~ -> dispatch_to('Demo') #~ -> handle; package Demo; sub hi { return "Hello, world"; }
clie.pl #!/usr/bin/perl -- use strict; use warnings; #!perl -w use SOAP::Lite +trace => 'all'; print SOAP::Lite #~ -> uri('http://146.225.100.232/Demo') #~ -> proxy('http://146.225.100.232:81/soap_server.pl') -> uri('http://127.0.0.1/Demo') -> proxy('http://127.0.0.1:1203') -> on_debug( sub {print @_}) -> hi() -> result;
and I get error
SOAP::Transport::new: () SOAP::Serializer::new: () SOAP::Deserializer::new: () SOAP::Parser::new: () SOAP::Lite::new: () SOAP::Transport::HTTP::Client::new: () SOAP::Lite::call: () SOAP::Serializer::envelope: () SOAP::Serializer::envelope: on_debug CODE(0x97a18c) SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0xe76e +e4) SOAP::Transport::HTTP::Client::send_receive: POST http://127.0.0.1:120 +3 HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 409 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://127.0.0.1/Demo#on_debug" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xm +lsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema +" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmln +s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><on_deb +ug xmlns="http://127.0.0.1/Demo" /></soap:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x10b +2a34) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Date: Wed, 09 Dec 2009 22:09:39 GMT Server: libwww-perl-daemon/5.827 Content-Length: 737 Content-Type: text/xml; charset=utf-8 Client-Date: Wed, 09 Dec 2009 22:09:39 GMT Client-Peer: 127.0.0.1:1203 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/0.710.10 <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xm +lsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema +" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmln +s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:F +ault><faultcode>soap:Client</faultcode><faultstring>Failed to access +class (Demo): Can't locate Demo.pm in @INC (@INC contains: C:/perl/5. +10.1/lib/MSWin32-x86-multi-thread C:/perl/5.10.1/lib C:/perl/site/5.1 +0.1/lib/MSWin32-x86-multi-thread C:/perl/site/5.10.1/lib .) at (eval +110) line 3. </faultstring><faultactor>http://localhost:1203/</faultactor></soap:Fa +ult></soap:Body></soap:Envelope> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () Can't locate object method "hi" via package "SOAP::SOM" at clie.pl lin +e 20. SOAP::SOM::DESTROY: () SOAP::Lite::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: ()
That first error can be fixed with
BEGIN { $INC{'Demo.pm'} = __FILE__; }
The error that follows can be fixed by removing on_debug
0.65-beta2 Mon Oct 25 2004 + Deprecated SOAP::Lite->on_debug removed
After that the program works