in reply to Re^4: Soap::lite - https ?
in thread Soap::lite - https ?

Sorry for the delay, it would appear we're in distant timezones.

Hmmm, when I initially did this long ago, I had to sub-class SOAP::Transport::HTTP::Daemon but I see that is no longer necessary.

Starting with the HTTP::Daemon server transport example from the SOAP::Lite guide, just pass the normal SSL options (defined in IO::Socket::SSL docs) to the new() call on SOAP::Transport::HTTP::Daemon.

If you don't need peer authentication, the following should work:

->new( LocalPort => 443, SSL_server => 1 ) ->dispatch_to(...)

IO::Socket::SSL seems to default the remaining options correctly inside HTTP::Daemon.

If you do need peer authentication, start reading about the options (and use of OpenSSL in general) in the docs for IO::Socket::SSL and Net::SSLeay.

If you want any more control over how each request is handled (before being passed to SOAP::Lite), you'll need to sub-class SOAP::Transport::HTTP::Daemon... there are a variety of other benefits to doing so.

-David.

Replies are listed 'Best First'.
Re^6: Soap::lite - https ?
by ethrbunny (Monk) on Aug 15, 2007 at 19:10 UTC
    Looks like it shouldn't be a big deal. Does the 'port' in question matter? IE does it have to be 443?

    EDIT - I installed IO::Socket::SSL and Net::SSLeay. Updated my server so it reads:
    use SOAP::Lite +trace; use SOAP::Transport::HTTP; use IO::Socket::SSL; $daemon = SOAP::Transport::HTTP::Daemon -> new (LocalPort => 8001, listen => 5, SSL_server => 1) -> dispatch_to(qw(auth)); print "Contact to SOAP server at ", $daemon->url, "\n"; $daemon->handle;


    Attempts to connect via https:// still meet with problems. Java reports "remote host closed connection during handshake." Perl just sits there. I don't think the SSL server is listening.
      What platform are you on? (I've had and solved thread-related problems on Win32)

      I think the best thing to do here would be to:

      1. test that you can get a working HTTPS server working first (and tested against your Java client),
      2. then to add a handler to it for SOAP::Lite (and anything else you please... eg: Pod::WSDL).

      The following modules all allow you to easily construct an HTTPS server:

      Does at least one of those methods give you a working HTTPS server on your platform?

      (Please test with just an SSL-capable webbrowser - ie: Firefox - to rule out the client-side as a problem.)

      If you're on windows (not cygwin) and you need to service more than one request simultaneously, you'll need to work around the problems caused by the partial lack of thread-safety in Net::SSLeay. It can be done, but I found it involved writing a much more complicated webserver.

      -David

      PS: are you definately prohibited from using Apache as your HTTPS/CGI server ? I could not use it in my situation, but it's a much easier solution than writing your own.

        I managed to get this code working. I had to modify /site/lib/SOAP/HTTP.pm and change the call to
        $self->{_daemon} = HTTP::Daemon::SSL->new(@params) or Carp::croak +"Can't create daemon: $!";
        so it would use the SSL version. This is going to make it tough to propagate my code.