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

Good day monastic ones. I am running a SOAP client and server. The relevant client sub is
sub send { my $data = shift; my $reply; my $result; my $server = SOAP::Lite + -> uri('http://www.soaplite.com/server') + -> proxy('http://xxx.xxx.xxx.xxx/cgi-bin/server.cgi', timeout => + 30); eval { $result = $server->store($data); }; if ($@) { $reply = $@; } elsif ($result->fault) { $reply = join ', ', $result->faultcode, $result->faultstring, $ +result->faultdetail,"sub=sendthread $threadid"; } return $reply; }
This has been running smoothly for months. Now recently a couple of times the client has issued the error "405 Method not allowed" for the the line containing the eval.

This perplexes me on several counts. (1) This is not a fault from the server because I'm not getting all the stuff in the elsif. (2) It's not a valid reply from the server. (3) This sub gets called repeatedly (by design) from the script that contains it . Once it generates this error, it continues to do so until I shut down the overall script, but (4) the minute I restart everything is fine again.

Anyone know what's going on?

Many TIA....Steve

Replies are listed 'Best First'.
Re: SOAP::Lite 405 Method not Allowed?
by jhourcle (Prior) on Apr 14, 2006 at 18:32 UTC

    The coupld of times I've seen this error mesage before, it was because the client wasn't sending a valid request. (eg, someone entering the SOAP proxy in their web client, and sending a GET, not a POST)

    I'd suggest using +trace, and looking at just what you're sending to the server.

    If you control the server, you can also dump some debugging info, as it's possible that something's getting corrupted in transmission. (eg, invisible HTTP proxying).

Re: SOAP::Lite 405 Method not Allowed?
by Thelonius (Priest) on Apr 14, 2006 at 18:48 UTC
    (1) This is not a fault from the server because I'm not getting all the stuff in the elsif.
    If the eval catches a "die", then the elsif part is not executed.
    (2) It's not a valid reply from the server.
    It's an HTTP reply code. If you're using the SOAP::Lite server, too, it will return a 405 response around line 293 of SOAP/Transport/HTTP.pm.

    Just as jhourcle says, it's returned if the request method is not "POST" (or "M-POST"). You need to to some logging to figure out why this is.