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

Hi,

I'm trying to get the Perl SOAP::Lite examples to work on a Windows PC, running Apache 2.2.4. Although I've several years' of Perl experience, my knowledge of webservers and their configuration etc is a little limited.

Apache is definitely serving CGI scripts, as I've tested a dummy Hello World thing. I'm also definitely getting a hit when I use a browser to get to my hibye.cgi server (well, a blank page rather than a 404).

However, when I run my hibye.pl client, I receive a 503 Service Unavailable at H:\scripts\hibye.pl line 25.

It works when I access the SOAP server at http://services.soaplite.com, but not the one on my webserver.

Is there some specific Apache config required? Am I missing something fundamental?

NB if I use localhost rather than the IP address I get 301 Moved Permanently.

Here's the server:-

#!C:/Perl/bin/perl -w use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI -> dispatch_to('Demo') -> handle; package Demo; sub hi { return "hello, world"; } sub bye { return "goodbye, cruel world"; } 1;
Here's the client:-

#!C:/Perl/bin/perl -w use strict; use SOAP::Lite; # use SOAP::Lite +debug; my $soap; print "Started\n"; $soap = SOAP::Lite -> uri('http://www.soaplite.com/Demo') + -> proxy('http://services.soaplite.com/hibye.cgi') -> hi(); if ( $soap -> fault ) { print "Failure - ".$soap->faultstring."\n"; } else { print "Success - ".$soap->result."\n"; } print "\n"; $soap = SOAP::Lite # -> uri('http://10.104.196.75/Demo') -> uri('http://10.104.196.75/Demo') + -> proxy('http://10.104.196.75/cgi-bin/hibye.cgi') # -> proxy('http://localhost/cgi-bin/hibye.cgi') -> bye(); # -> result; if ( $soap -> fault ) { print "Failure - ".$soap->faultstring."\n"; } else { print "Success - ".$soap->result."\n"; } print "Finished\n";

Here's the debug output:-

H:\scripts>hibye.pl Unquoted string "debug" may clash with future reserved word at H:\scri +pts\hibye. pl line 5. Started 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: hi SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x1b7a +244) SOAP::Transport::HTTP::Client::send_receive: POST http://services.soap +lite.com/h ibye.cgi Accept: text/xml Accept: multipart/* Proxy-Authorization: Basic SU1camdvb2NoOkJlcm5hcmQzMw== Content-Length: 450 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://www.soaplite.com/Demo#hi" <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="ht +tp://www.w 3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap. +org/soap/e ncoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:xsd=" http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schem +as.xmlsoap .org/soap/encoding/"><SOAP-ENV:Body><namesp1:hi xmlns:namesp1="http:// +www.soapli te.com/Demo"/></SOAP-ENV:Body></SOAP-ENV:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x1d7 +bb88) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Mon, 13 Aug 2007 14:55:59 GMT Server: Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/ +2.4.2 mod_ gzip/1.3.26.1a PHP/4.4.7 mod_ssl/2.8.22 OpenSSL/0.9.7e Content-Length: 535 Content-Type: text/xml; charset=utf-8 Client-Date: Mon, 13 Aug 2007 14:54:17 GMT Client-Peer: 192.168.12.29:8080 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/0.55 <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="ht +tp://www.w 3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap. +org/soap/e ncoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:xsd=" http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schem +as.xmlsoap .org/soap/encoding/"><SOAP-ENV:Body><namesp1:hiResponse xmlns:namesp1= +"http://ww w.soaplite.com/Demo"><s-gensym3 xsi:type="xsd:string">hello, world</s- +gensym3></ namesp1:hiResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () SOAP::SOM::new: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () Success - hello, world 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: bye SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x1e5e +0dc) SOAP::Transport::HTTP::Client::send_receive: POST http://10.104.196.75 +/cgi-bin/h ibye.cgi Accept: text/xml Accept: multipart/* Proxy-Authorization: Basic SU1camdvb2NoOkJlcm5hcmQzMw== Content-Length: 448 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://10.104.196.75/Demo#bye" <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="ht +tp://www.w 3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap. +org/soap/e ncoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" x +mlns:xsd=" http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schem +as.xmlsoap .org/soap/encoding/"><SOAP-ENV:Body><namesp2:bye xmlns:namesp2="http:/ +/10.104.19 6.75/Demo"/></SOAP-ENV:Body></SOAP-ENV:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x1e5 +f028) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 503 Service Unav +ailable Cache-Control: no-cache Connection: close Pragma: no-cache Content-Length: 751 Content-Type: text/html Client-Date: Mon, 13 Aug 2007 14:55:07 GMT Client-Peer: 192.168.12.29:8080 Client-Response-Num: 1 Proxy-Connection: close Title: Network Error <HTML><HEAD> <TITLE>Network Error</TITLE> </HEAD> <BODY> <FONT face="Helvetica"> <big><strong></strong></big><BR> </FONT> <blockquote> <TABLE border=0 cellPadding=1 width="80%"> <TR><TD> <FONT face="Helvetica"> <big>Network Error (tcp_error)</big> <BR> <BR> </FONT> </TD></TR> <TR><TD> <FONT face="Helvetica"> A communication error occurred: "Operation timed out" </FONT> </TD></TR> <TR><TD> <FONT face="Helvetica"> The Web Server may be down, too busy, or experiencing other problems p +reventing it from responding to requests. You may wish to try again at a later t +ime. </FONT> </TD></TR> <TR><TD> <FONT face="Helvetica" SIZE=2> <BR> For assistance, contact your network support team. </FONT> </TD></TR> </TABLE> </blockquote> </FONT> </BODY></HTML> SOAP::Deserializer::deserialize: () SOAP::Parser::decode: () 503 Service Unavailable at H:\scripts\hibye.pl line 25 SOAP::SOM::DESTROY: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Parser::DESTROY: ()

Thanks for any help.

J.

Replies are listed 'Best First'.
Re: SOAP::Lite and Apache
by almut (Canon) on Aug 15, 2007 at 18:21 UTC

    I could be wrong, but to me this looks like a rather low level routing problem. Something to do with HTTP proxy or firewall setup. Before coming up with any more detailed hypotheses, however, I'd like you to answer the following questions, which might help to narrow down on what's wrong:

    • Are you using a proxy if you're connecting from the browser?
    • Do you have an HTTP proxy configured in the environment from where you're running the client script? (SOAP::Lite would try to use a proxy specified in the environment variable HTTP_proxy, if found)
    • In case you have HTTP_proxy set, what happens if you unset it?
    • Can you access the webserver from the command line via a simple telnet 10.104.196.75 80 and/or telnet localhost 80?
    • In which of the above connection attempts are you getting any corresponding entries in the webserver's access logfile?
      Thank you! You're absolutely right. I'd done a tracert to ensure that the webserver could be found via the address I was using but what I hadn't considered was that I'd set HTTP_proxy, HTTP_proxy_pass and HTTP_proxy_user on my development PC in order to get ppm working. Our dev PCs are locked down into their own domain and we have to bounce via the production proxy to get to the Internet. Up until now, I've only ever considered these environment variables to be ppm-related, but it makes perfect sense for SOAP::Lite to use them, too. Ergo, all my requests were going externally. This also explains why I wasn't seeing anything in the webserver's log file ('cos it wasn't being given anything from the client).

      So, I've removed them and hey presto!

      Thanks again,

      J.