I am trying to use PERL to access Service Now database using the ServiceNow API provided. I could not find any threads pertaining to this. I hope someone might be able to give me some direction.
All necessary Modules are installed. I pulled the code attempted from sample code from on how to query ServiceNow records. Code is almost exactly as appears in example on this site. Problem is, when I execute, it fails with:
Can't call method "getUserName" on an undefined value at C:/Perl64/site/lib/ServiceNow/Connection.pm line 39.
The Connection.pm at line 39 has this:
# implement SOAP::Lite's basic auth strategy
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return $CONFIG->getUserName() => $CONFIG->getUserPassword();
}
Any idea what this error is telling me or how I can correct this? I really need any help or direction you could offer. Thanks.
Below is the code I am using which is exactly as suggested except where specific to my site.
use ServiceNow::SOAP;
my $username = "ServiceNow_acct";
my $password = "servicenow_pw";
my $sn = ServiceNow(" $username, $password);
my $table = $sn->table("cmdb_ci_server");
my @serverData = $table->query("operational_status=1")->fetchAll();
foreach my $serverRec (@serverData) {
print $serverRec->{name}, "\n";
}
# end code
All necessary Modules are installed. I pulled the code attempted from sample code from on how to query ServiceNow records. Code is almost exactly as appears in example on this site. Problem is, when I execute, it fails with:
Can't call method "getUserName" on an undefined value at C:/Perl64/site/lib/ServiceNow/Connection.pm line 39.
The Connection.pm at line 39 has this:
# implement SOAP::Lite's basic auth strategy
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return $CONFIG->getUserName() => $CONFIG->getUserPassword();
}
Any idea what this error is telling me or how I can correct this? I really need any help or direction you could offer. Thanks.
Below is the code I am using which is exactly as suggested except where specific to my site.
use ServiceNow::SOAP;
my $username = "ServiceNow_acct";
my $password = "servicenow_pw";
my $sn = ServiceNow(" $username, $password);
my $table = $sn->table("cmdb_ci_server");
my @serverData = $table->query("operational_status=1")->fetchAll();
foreach my $serverRec (@serverData) {
print $serverRec->{name}, "\n";
}
# end code