Perl API Error: Can't verify SSL peers

emarkiewicz
Kilo Explorer

I could use some help. I have downloaded the ServiceNow API, installed it and downloaded all the required Perl modules that have been suggested - I think. When I try to run a simple script I get the following error;

500 Can't verify SSL peers without knowning which Certificate Authorities to trust at /usr/lib/perl5/site_perl/5.8.8/ServiceNow/Connection.pm line 70.

The script is below;

#!/usr/bin/perl

use ServiceNow;
use ServiceNow::Configuration;
use strict;

print "Start Test\n";

my $CONFIG = ServiceNow::Configuration->new();
$CONFIG->setSoapEndPoint("https://xxxxxxxx.service-now.com/");
$CONFIG->setUserName("xxxxxxxxxxxx");
$CONFIG->setUserPassword("xxxxxxxxxxxx");

my $SN = ServiceNow->new($CONFIG);
my $me;
my $glideRecord = ServiceNow::GlideRecord->new($CONFIG,'cmdb_ci_list',$me);
my $gliderecords;

my $testIP = "nnn.nnn.nnn.nnn";
$gliderecords = $glideRecord->query({ 'ip_address'=> $testIP, 'install_status' => 'Installed', '__limit'=>'1000'});

print "RECORD: " . $gliderecords . "\n";

print "We B Done!\n";


Any help would be greatly appreciated.
~Ed

9 REPLIES 9

BB1234
Kilo Explorer

When I run the above script, I am getting the following error.

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 401 Unauthorized

Could this be a configuration problem?
All my packages are updated.
running perl 5.8.8 on redhat


That error usually comes from either: 1) not specifying credentials, 2) not specifying correct credentials, or 3)not specifying credentials with the proper rights when posting the web service request.


Are these settings correct?

I am setting the user/passwd with:
$ENV{PROXY_user}='xxxx';
$ENV{PROXY_pass}='xxxx';

and

$CONFIG->setUserName("xxxx");
$CONFIG->setUserPassword("xxxx");

as show in the source above.




This was an issue of the wrong proxy server. Once I switched to the correct proxy, I got all my information back.

Thanks.


I am setting the user/passwd with:
$ENV{PROXY_user}='xxxx';
$ENV{PROXY_pass}='xxxx';

and


$CONFIG->setUserName("xxxx");
$CONFIG->setUserPassword("xxxx");

as show in the source above.

I have also added user/passwd to the proxy address:
https://user:pwd\@proxy.com:443/