Juniper NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 Manual page 96

Api guide
Table of Contents

Advertisement

Network and Security Manager 2010.4 API Guide
78
if ( defined $input ) {
$response = $soap_service->call($soap_method, @{$input});
} else {
$response = $soap_service->call($soap_method);
}
if ($response->fault) {
print "$service#$method: " . $response->faultcode .": " .
$response->faultstring . "\n";
exit 1;
}
return $response;
}
sub login($$) {
my $username = shift;
my $password = shift;
my @apiLogin = (
SOAP::Data->name('domainName')->value('global'),
SOAP::Data->name('userName')->value($username),
SOAP::Data->name('password')->value($password)
);
my $response = soap_call("SystemService","LoginRequest",\@apiLogin);
my $loginStatus = $response->valueof("//Body/LoginResponse/loginStatus/status");
if ($loginStatus eq "Success" ) {
$main::LOGIN_TOKEN =
$response->valueof("//Body/LoginResponse/authToken/Token");
} elsif ( $loginStatus eq "Failure" ) {
print "Invalid credentials", "\n";
exit 1;
}
}
sub get_all_sds() {
my @token = (
SOAP::Data->name('Token')->value($LOGIN_TOKEN)->prefix('ns1')
);
my @AuthToken = (
SOAP::Data->name('AuthToken')->value(\@token)->prefix('ns1')->uri('http://juniper.net/core')
);
my $response = soap_call("SystemService","GetSystemInfoRequest", \@AuthToken);
return $response;
}
login("super","netscreen");
print $LOGIN_TOKEN, "\n";
get_all_sds;
Copyright © 2010, Juniper Networks, Inc.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Network and security manager 2010.4

Table of Contents