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

Any SOAP or SOAP::Lite users out there? I'm very new to SOAP and I was working on the exercises at http://guide.soaplite.com/ to set up something simple to bang on before I start working on my production code. I tried to set up the author's demo server:
#!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"; }
But when I try to run the script, I keep getting the error: Status: 411 Length Required. ...and the script terminates. I have an idea what the error itself means in a client-server context, but it appears that the server is coming up with this own its own. Any help would be much appriciated.

Replies are listed 'Best First'.
Re: SOAP::Transport::HTTP::CGI 411 Error
by themage (Friar) on Nov 17, 2006 at 09:37 UTC
    Hi timecatalyst,

    The reason for the error you are getting is that (probably) you are running the script directly, and it is intented to be run as a CGI, in you HTTP Server, and then called by HTTP with a SOAP client.

    In the SOAP::Lite guide you can see that for each SOAP server there is an equivalent SOAP client, just in the next code example.

    That's because SOAP is intented to remote procedure call, in the specific case you are using (and the most common), over HTTP. That SOAP server you created is intented to be run as a cgi.

    Put it in a cgi directory in a webserver (apache or anyother), and try running the client just next to the server, with the correct URL for your cgi (this is obvious, I know, but important), and I think everything will workm just fine. If not come back to us with more details.

      Yeah, that's exactly what it was. Sorry, it was a long week. For some reason I had it in my mind that SOAP::Lite was starting up an HTTP server. Not sure how I came to that conclusion. Thanks for the feedback.
Re: SOAP::Transport::HTTP::CGI 411 Error
by mda2 (Hermit) on Nov 17, 2006 at 20:34 UTC
    Status 411 is an error check on CGI Transport, made with ENV content...

    part of .../SOAP/Transport/HTTP.pm file

    If you need to test without CGI, test with a Local (IO) or standalone transport...

    --
    Marco Antonio
    Rio-PM