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

There is a HTTP::Daemon::SSL module which can be used easily from SOAP::Lite.

If your server is single-threaded or forking, that should be enough. If your server needs to be multi-threaded, you will run into problems with SSL misbehaving under threads.

I ended up writing a multiplexed (single-threaded server) directly on top of IO::Socket::SSL, inside a module which gets passed a Thread::Queue handle so that the work for each connection can be farmed out to other threads.

I got some help here with the mutliplexing HTTPS server, so do a super-search and you'll find a working example.

-David

Replies are listed 'Best First'.
Re^4: Soap::lite - https ?
by ethrbunny (Monk) on Aug 11, 2007 at 15:43 UTC
    There is a HTTP::Daemon::SSL module which can be used easily from SOAP::Lite.

    Can you give me any more information about this?

    I have a working version running via 'ssltunnel'. My next step is to process the info from a java client. Gah.
      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.

        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.

      Yes it is possible when you define server code like this:
      my $daemon = SOAP::Transport::HTTP::Daemon
      ->new( LocalPort => DAEMON_PORT,
      Listen => 1,
      SSL_use_cert => 1,
      SSL_key_file => PRIVATE_KEY_PATH,
      SSL_cert_file => CERTIFICATE_PATH,
      Reuse => 1)
      -> dispatch_to('Handler');

      Off course, you have to install HTTP::Daemon::SSL, generate a certificate and a private key before using this code...

      It's a few late but it should be usefull for other poeples like me, a week ago...