Perl: Cannot Access Web Service with SSL

后端 未结 8 720
礼貌的吻别
礼貌的吻别 2021-01-21 12:28

This is my first Perl script. I have installed SOAP::Lite using CPAN and it seems to have gone okay.

I\'m trying to access a simple HelloWorld .NET web service. I\'m get

8条回答
  •  心在旅途
    2021-01-21 12:38

    Just found this thread, and everything was very useful to me, thanks!

    I wanted to added my "solution", which is a variation on the previous ones, in case it helps someone else.

    Adding

    $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
    

    is definitely key. However, this causes a big warning to come out of IO::Socket::SLL:

    *******************************************************************
     Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
     is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
     together with SSL_ca_file|SSL_ca_path for verification.
     If you really don't want to verify the certificate and keep the
     connection open to Man-In-The-Middle attacks please set
     SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
    *******************************************************************
    

    The way to get rid of that warning was to add these lines:

    use IO::Socket::SSL;
    IO::Socket::SSL::set_defaults(SSL_verify_mode => "SSL_VERIFY_NONE");
    

    In addition to the original $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}, that should work no matter what client you're using (LWP::UserAgent, RPC::XML::Client, SOAP::Lite, etc.).

    Hope that helps someone else!

提交回复
热议问题