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

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.

Replies are listed 'Best First'.
Re^5: Soap::lite - https ?
by erroneousBollock (Curate) on Aug 12, 2007 at 06:46 UTC
    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.
        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.

Re^5: Soap::lite - https ?
by Anonymous Monk on Apr 03, 2008 at 11:25 UTC

    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...