in reply to REST call from CGI do not work

Stepping back away from this very familiar requirement a few paces, here are some things that worked for me:

  1. On the server side, use a package such as one of the RPC::Any family as a convenient framework and protocol for dealing with requests including any that result in a server-side error.   (Whether an error occurs or not, the server’s response should always be a JSON packet.   The suggested package-suite neatly deals with this any many other sundry matters.   Click on the link next to the author’s name to see everything in it.)
  2. On the client side, have the client include a short random string that the server is always obliged to echo back verbatim in its response, whatever that response may be.   The client side software checks it.
  3. As a design point, I find it convenient that, if the server returns an error response, the client side initially throws an exception of its own, and catches it elsewhere.

Replies are listed 'Best First'.
Re^2: REST call from CGI do not work
by Sterh (Novice) on Jun 06, 2012 at 00:38 UTC

    Solution was to include this into the code:

     $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

    So it will not check certificate

      Solution was to include this into the code:

      :) Ignoring a security problem is never a solution

      It also looks like you're using an older version of LWP toolchain

      The real solution is to upgrade LWP and all dependencies, even Mozilla::CA