Problem this snippet solves:
This script is an example of how to use the iControl interfaces provided by an ARX to monitor and manage all schedules on an ARX.
How to use this snippet:
ARXScheduleExample.pl --url --user --pass
Prerequisites
- SOAP::Lite perl module
- An F5 ARX system running release V6.02.000 or later.
- Management access on the ARX must be permitted for HTTPs-API or HTTP-API services.
Code :
#!/usr/bin/perl
#-------------------------------------------------------------------------------
# The contents of this file are subject to the "END USER LICENSE AGREEMENT
# FOR F5 Software Development Kit for iControl"; you may not use this file
# except in compliance with the License. The License is included in the
# iControl Software Development Kit.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is iControl Code and related documentation
# distributed by F5.
#
# The Initial Developer of the Original Code is F5 Networks,
# Inc. Seattle, WA, USA. Portions created by F5 are Copyright (C) 1996-2012
# F5 Networks, Inc. All Rights Reserved. iControl (TM) is a registered
# trademark of F5 Networks, Inc.
#
# Alternatively, the contents of this file may be used under the terms
# of the GNU General Public License (the "GPL"), in which case the
# provisions of GPL are applicable instead of those above. If you wish
# to allow use of your version of this file only under the terms of the
# GPL and not to allow others to use your version of this file under the
# License, indicate your decision by deleting the provisions above and
# replace them with the notice and other provisions required by the GPL.
# If you do not delete the provisions above, a recipient may use your
# version of this file under either the License or the GPL.
#-------------------------------------------------------------------------------
#
# Description
#
# This script is an example of how to use the iControl interfaces provided by
# an ARX to monitor and manage all schedules on an ARX.
#
# Usage: ARXScheduleExample.pl --url <url> --user <user> --pass <password> --op <arxschedule api="" method="">
#
# Prerequisites:
#
# This script requires the following:
#
# * SOAP::Lite perl module
# * An F5 ARX system running release V6.02.000 or later.
# * Management access on the ARX must be permitted for HTTP-API and HTTPS-API
# services.
#
# For more information on ARX configuration, please consult the
# documentation that was provided with your ARX system.
#-------------------------------------------------------------------------------
# SOAP::Lite lets us send SOAP requests and parse them
use SOAP::Lite
autotype => 0,
default_ns => 'urn:iControl';
# If you need to debug problems with your script, you can use the +trace
# option with SOAP::Lite and it will print the XML sent to and received from
# the server:
#
# use SOAP::Lite
# autotype => 0,
# default_ns => 'urn:iControl' + trace;
# Getopt::Long lets us easily parse command line options
use Getopt::Long;
use POSIX qw(strftime);
use Carp;
use Time::Local;
use strict;
use warnings;
#-------------------------------------------------------------------------------
# Main program logic
#-------------------------------------------------------------------------------
our ($url, $user, $pass, $op);
# Load command line options - if the load fails, then we print the usage
# instructions and exit.
if (!GetOptions("url=s" => \$url,
"user=s" => \$user,
"pass=s" => \$pass,
"op=s" => \$op)) {
usage();
exit(1);
}
# If any arguments were skipped, print the usage instructions and exit.
if (!defined $url || !defined $user || !defined $pass || !defined $op) {
usage();
exit(1);
}
# The service path for interface "Interface" is this:
#
# http://<hostname>:<port>/api/services/Interface
#
my $scheduleServiceUrl = $url . "/api/services/Schedule";
# In order for SOAP to access a web service, it needs to read the WSDL
# for the interface you want to use. The WSDL file for an interface
# called "Interface" is available via http/https on the ARX at:
#
# http://<hostname>:<port>/api/services/Interface?wsdl
#
# If you need a WSDL 2.0 version, that is also available at:
#
# http://<hostname>:<port>/arx-api/wsdl/Interface.wsdl2
#
# In this case, we're using the Schedule interface and we're
# interested in using the WSDL 1.1 version.
#
my $scheduleWsdlUrl = $scheduleServiceUrl . "?wsdl";
# Now we build our SOAP::Lite object using the service and WSDL
# URLs
my $scheduleSoap = SOAP::Lite->new(proxy => $scheduleServiceUrl,
service => $scheduleWsdlUrl);
if ($op eq "get_list")
{
get_list();
}
elsif ($op eq "get_configuration")
{
get_configuration();
}
elsif ($op eq "get_status")
{
get_status();
}
elsif ($op eq "create")
{
create();
}
elsif ($op eq "set_description")
{
set_description();
}
elsif ($op eq "set_duration")
{
set_duration();
}
elsif ($op eq "set_interval")
{
set_interval();
}
elsif ($op eq "set_start")
{
set_start();
}
elsif ($op eq "set_stop")
{
set_stop();
}
elsif ($op eq "create_and_configure")
{
create_and_configure();
}
elsif ($op eq "remove")
{
remove();
}
#-------------------------------------------------------------------------------
# End of main program logic
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# sub usage
#-------------------------------------------------------------------------------
sub usage
{
print "\nUsage: ARXScheduleExample.pl --url <url> --user <user> --pass <password> --op <arxschedule api="" method="">\n";
print "\n";
print "Argument Description\n";
print "-------- -----------\n";
print "--url The base URL of the web service on the ARX. Both http and https\n";
print " are supported. The format is:\n";
print "\n";
print " http(s)://<hostname>:<port>\n";
print "\n";
print " <hostname>: DNS resolvable hostname or IP address\n";
print " <port>: 83 for http or 843 for https\n";
print "\n";
print "--user The username for authentication.\n";
print "--pass The password for authentication.\n";
print "\n";
print "--op The ARXSchedule API method that will be called:\n";
print "\n";
print " create\n";
print " create_and_configure\n";
print " set_description\n";
print " set_duration\n";
print " set_interval\n";
print " set_start\n";
print " set_stop\n";
print " get_list\n";
print " get_configuration\n";
print " get_status\n";
print " remove\n";
print "\n";
}
#-------------------------------------------------------------------------------
# sub getSecurityHeader(user, pass)
#
# This subroutine builds a security header that will be used for
# authentication. This type of security header is required for all calls to
# iControl::ARX interfaces, so it makes sense to have this subroutine stored in
# a library for common access.
#-------------------------------------------------------------------------------
sub getSecurityHeader
{
my $user = shift;
my $pass = shift;
my $now = time();
my $then = time() + 60;
my $created = strftime("%Y-%m-%dT%H:%M:%S", gmtime($now)) . 'Z';
my $expires = strftime("%Y-%m-%dT%H:%M:%S", gmtime($then)) . 'Z';
my $secExt = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
my $secUtil = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';
my $securityHeader = SOAP::Header->name("wsse:Security")->attr(
{
'xmlns:wsse'=> $secExt,
'xmlns:wsu'=> $secUtil
}
);
my $timestamp = SOAP::Data->name("wsu:Timestamp" =>
\SOAP::Data->value(
SOAP::Data->name('wsu:Created')->value($created)
->type(''),
SOAP::Data->name('wsu:Expires')->value($expires)
->type('')));
my $usernameTokenType =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";
my $usernameToken = SOAP::Data->name("wsse:UsernameToken" =>
\SOAP::Data->value(
SOAP::Data->name('wsse:Username')->value($user)
->type(''),
SOAP::Data->name('wsse:Password')->value($pass)
->type('')
->attr({'Type'=>$usernameTokenType})));
$securityHeader->value(\SOAP::Data->value($timestamp, $usernameToken));
return $securityHeader;
}
sub create
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Calling the \"create\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n\n";
# Build a security header
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->create(SOAP::Data->name('schedule')->value($schedule),
$securityHeader);
# Check if there were any faults encountered during the operation.
# We find this by checking if the fault member of the result object
# is set. If there is a fault, then we can print the detailed
# fault text using the faultstring member of the result object.
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub create_and_configure
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify a description:\n\n";
chomp(my $description = <>);
print "\n";
print "Please specify a duration:\n\n";
chomp(my $duration = <>);
print "\n";
print "Please specify a start time (mm/dd/yyyy:hh:mm):\n\n";
chomp(my $time = <>);
my $month = substr($time, 0, 2) - 1;
my $day = substr($time, 3, 2);
my $year = substr($time, 6, 4);
my $hour = substr($time, 11, 2);
my $minute = substr($time, 14, 2);
my $start = timelocal(0, $minute, $hour, $day, $month, $year);
print "\n";
print "Please specify a stop time (mm/dd/yyyy:hh:mm):\n\n";
chomp($time = <>);
$month = substr($time, 0, 2) - 1;
$day = substr($time, 3, 2);
$year = substr($time, 6, 4);
$hour = substr($time, 11, 2);
$minute = substr($time, 14, 2);
my $stop = timelocal(0, $minute, $hour, $day, $month, $year);
print "\n";
print "Please specify either 'ARX_INTERVAL_UNKNOWN', 'ARX_INTERVAL_MINUTES', 'ARX_INTERVAL_HOURS', 'ARX_INTERVAL_DAYS', 'ARX_INTERVAL_WEEKS', 'ARX_INTERVAL_MONTHS', 'ARX_INTERVAL_QUARTERS', 'ARX_INTERVAL_YEARS', 'ARX_INTERVAL_FIRST_DAY', 'ARX_INTERVAL_LAST_DAY', 'ARX_INTERVAL_HOURS_OF_DAY', 'ARX_INTERVAL_DAYS_OF_WEEK', or 'ARX_INTERVAL_DAYS_OF_MONTH' for the 'interval_type':\n\n";
chomp(my $intervalType = <>);
print "\n";
print "Please specify an 'interval':\n\n";
chomp(my $interval = <>);
print "\n";
print "Calling the \"create_and_configure\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "description: $description\n";
print "duration: $duration\n";
print "start_time: $start\n";
print "stop_time: $stop\n";
print "interval_type: $intervalType\n";
print "interval: $interval\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->create_and_configure(SOAP::Data->name('configuration' => \SOAP::Data->value(
SOAP::Data->name("name" => $schedule),
SOAP::Data->name("description" => $description),
SOAP::Data->name("duration" => $duration),
SOAP::Data->name("start_time" => $start,
SOAP::Data->name("stop_time" => $stop),
SOAP::Data->name("interval_type" => $intervalType),
SOAP::Data->name("interval" => $interval))
)),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub set_description
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify a description:\n\n";
chomp(my $description = <>);
print "\n";
print "Calling the \"set_description\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "description: $description\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->set_description(SOAP::Data->name('schedule')->value($schedule),
SOAP::Data->name('description')->value($description),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub set_duration
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify a duration:\n\n";
chomp(my $duration = <>);
print "\n";
print "Calling the \"set_duration\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "duration: $duration\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->set_duration(SOAP::Data->name('schedule')->value($schedule),
SOAP::Data->name('duration')->value($duration),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub set_interval
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify either 'ARX_INTERVAL_UNKNOWN', 'ARX_INTERVAL_MINUTES', 'ARX_INTERVAL_HOURS', 'ARX_INTERVAL_DAYS', 'ARX_INTERVAL_WEEKS', 'ARX_INTERVAL_MONTHS', 'ARX_INTERVAL_QUARTERS', 'ARX_INTERVAL_YEARS', 'ARX_INTERVAL_FIRST_DAY', 'ARX_INTERVAL_LAST_DAY', 'ARX_INTERVAL_HOURS_OF_DAY', 'ARX_INTERVAL_DAYS_OF_WEEK', or 'ARX_INTERVAL_DAYS_OF_MONTH' for the 'interval_type':\n\n";
chomp(my $intervalType = <>);
print "\n";
print "Please specify an 'interval':\n\n";
chomp(my $interval = <>);
print "\n";
print "Calling the \"set_interval\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "interval_type: $intervalType\n";
print "interval: $interval\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->set_interval(SOAP::Data->name('schedule')->value($schedule),
SOAP::Data->name("interval_type" => $intervalType),
SOAP::Data->name("interval" => $interval),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub set_start
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify a start time (mm/dd/yyyy:hh:mm):\n\n";
chomp(my $time = <>);
my $month = substr($time, 0, 2) - 1;
my $day = substr($time, 3, 2);
my $year = substr($time, 6, 4);
my $hour = substr($time, 11, 2);
my $minute = substr($time, 14, 2);
my $start = timelocal(0, $minute, $hour, $day, $month, $year);
print "\n";
print "Calling the \"set_start\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "time: $start\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->set_start(SOAP::Data->name('schedule')->value($schedule),
SOAP::Data->name('time')->value($start),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub set_stop
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Please specify a stop time (mm/dd/yyyy:hh:mm):\n\n";
chomp(my $time = <>);
my $month = substr($time, 0, 2) - 1;
my $day = substr($time, 3, 2);
my $year = substr($time, 6, 4);
my $hour = substr($time, 11, 2);
my $minute = substr($time, 14, 2);
my $stop = timelocal(0, $minute, $hour, $day, $month, $year);
print "\n";
print "Calling the \"set_stop\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
print "time: $stop\n\n";
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->set_stop(SOAP::Data->name('schedule')->value($schedule),
SOAP::Data->name('time')->value($stop),
$securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub get_list
{
# Get a list of schedules configured on the ARX.
print "Calling the \"get_list\" method of the ARX Schedule interface.\n\n";
# Build a security header
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->get_list($securityHeader);
# Check if there were any faults encountered during the operation.
# We find this by checking if the fault member of the result object
# is set. If there is a fault, then we can print the detailed
# fault text using the faultstring member of the result object.
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
print "Printing the results of the call to the \"get_list\" method of the ARX Schedule interface.\n\n";
# The get_list() call did not fail, so we build a list of schedule
# names from the result. Note that the full result is a
# concatenation of the result and paramsout members of the SOAP
# result object.
my @scheduleList = ($scheduleSoapResult->result,
$scheduleSoapResult->paramsout);
if ($#scheduleList < 0) {
print("The list of schedules returned from the call to the \"get_list\" method of the ARX Schedule interface was empty.\n");
exit(0);
}
# We can now print the list of schedules
print "Schedule list:\n";
foreach my $schedule (@scheduleList) {
print " ", $schedule, "\n";
}
print "\n";
}
sub get_configuration
{
# Get a list of schedules configured on the ARX.
print "Calling the \"get_list\" method of the ARX Schedule interface.\n\n";
# Build a security header
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->get_list($securityHeader);
# Check if there were any faults encountered during the operation.
# We find this by checking if the fault member of the result object
# is set. If there is a fault, then we can print the detailed
# fault text using the faultstring member of the result object.
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
print "Printing the results of the call to the \"get_list\" method of the ARX Schedule interface.\n\n";
# The get_list() call did not fail, so we build a list of schedule
# names from the result. Note that the full result is a
# concatenation of the result and paramsout members of the SOAP
# result object.
my @scheduleList = ($scheduleSoapResult->result,
$scheduleSoapResult->paramsout);
if ($#scheduleList < 0) {
print("The list of schedules returned from the call to the \"get_list\" method of the ARX Schedule interface was empty.\n");
exit(0);
}
# get schedule configuration from API
print "Calling the \"get_configuration\" method of the ARX Schedule interface.\n\n";
# Build a security header
$securityHeader = getSecurityHeader($user, $pass);
# In addition to printing the list of schedules, we can actually
# use that list to retrieve configuration information
# for all of the schedules using the same list by calling
# get_configuration().
$scheduleSoapResult = $scheduleSoap->get_configuration(SOAP::Data->name('schedules')->value(@scheduleList), $securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
print "Printing the results of the call to the \"get_configuration\" method of the ARX Schedule interface.\n\n";
my @scheduleConfigs = ($scheduleSoapResult->result, $scheduleSoapResult->paramsout);
foreach my $scheduleConfig (@scheduleConfigs) {
my $name = $scheduleConfig->{'name'};
print "----------------------------------------------\n";
print "Schedule: ", $name, "\n";
print "----------------------------------------------\n\n";
print "name: ", $name, "\n";
my $description = $scheduleConfig->{'description'};
print "description: ", $description, "\n";
my $duration = $scheduleConfig->{'duration'};
print "duration: ", $duration, "\n";
my $start_time = $scheduleConfig->{'start_time'};
print "start_time: ", $start_time, "\n";
my $stop_time = $scheduleConfig->{'stop_time'};
print "stop_time: ", $stop_time, "\n";
my $interval_type = $scheduleConfig->{'interval_type'};
print "interval_type: ", $interval_type, "\n";
my $interval = $scheduleConfig->{'interval'};
print "interval: ", $interval, "\n";
print "\n";
}
}
sub get_status
{
# Get a list of schedules configured on the ARX.
print "Calling the \"get_list\" method of the ARX Schedule interface.\n\n";
# Build a security header
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->get_list($securityHeader);
# Check if there were any faults encountered during the operation.
# We find this by checking if the fault member of the result object
# is set. If there is a fault, then we can print the detailed
# fault text using the faultstring member of the result object.
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
print "Printing the results of the call to the \"get_list\" method of the ARX Schedule interface.\n\n";
# The get_list() call did not fail, so we build a list of schedule
# names from the result. Note that the full result is a
# concatenation of the result and paramsout members of the SOAP
# result object.
my @scheduleList = ($scheduleSoapResult->result,
$scheduleSoapResult->paramsout);
if ($#scheduleList < 0) {
print("The list of schedules returned from the call to the \"get_list\" method of the ARX Schedule interface was empty.\n");
exit(0);
}
# get schedule status from API
print "Calling the \"get_status\" method of the ARX Schedule interface.\n\n";
# Build a security header
$securityHeader = getSecurityHeader($user, $pass);
# In addition to printing the list of volumes, we can actually
# use that list to retrieve status information for all of the volumes
# using the same list by calling get_status().
$scheduleSoapResult = $scheduleSoap->get_status(SOAP::Data->name('schedules')->value(@scheduleList), $securityHeader);
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
print "Printing the results of the call to the \"get_status\" method of the ARX Schedule interface.\n\n";
my @scheduleStatuses = ($scheduleSoapResult->result, $scheduleSoapResult->paramsout);
foreach my $scheduleStatus (@scheduleStatuses) {
my $schedule = $scheduleStatus->{'schedule'};
print "----------------------------------------------\n";
print "Schedule: ", $schedule, "\n";
print "----------------------------------------------\n\n";
print "schedule: ", $schedule, "\n";
my $status = $scheduleStatus->{'status'};
print "status: ", $status, "\n";
if (exists $scheduleStatus->{'previous'}) {
my $previous = $scheduleStatus->{'previous'};
print "previous:\n";
my $prevRunTime = $previous->{'run_time'};
print " run_time: ", $prevRunTime, "\n";
my $prevEndTime = $previous->{'end_time'};
print " end_time: ", $prevEndTime, "\n";
}
if (exists $scheduleStatus->{'current'}) {
my $current = $scheduleStatus->{'current'};
print "current:\n";
my $curRunTime = $current->{'run_time'};
print " run_time: ", $curRunTime, "\n";
my $curEndTime = $current->{'end_time'};
print " end_time: ", $curEndTime, "\n";
}
if (exists $scheduleStatus->{'next'}) {
my $next = $scheduleStatus->{'next'};
print "next:\n";
my $nextRunTime = $next->{'run_time'};
print " run_time: ", $nextRunTime, "\n";
my $nextEndTime = $next->{'end_time'};
print " end_time: ", $nextEndTime, "\n";
}
print "\n";
}
}
sub remove
{
print "Please specify a schedule name:\n\n";
chomp(my $schedule = <>);
print "\n";
print "Calling the \"remove\" method of the ARX Schedule interface with the following parameters:\n\n";
print "schedule: $schedule\n";
# Build a security header
my $securityHeader = getSecurityHeader($user, $pass);
my $scheduleSoapResult = $scheduleSoap->remove(SOAP::Data->name('schedule')->value($schedule),
$securityHeader);
# Check if there were any faults encountered during the operation.
# We find this by checking if the fault member of the result object
# is set. If there is a fault, then we can print the detailed
# fault text using the faultstring member of the result object.
if (defined $scheduleSoapResult->fault && $scheduleSoapResult->fault) {
confess("SOAP request failed:\n" . objdump($scheduleSoapResult->fault) . "\n");
}
}
sub objdump
{
my ($obj, $indent) = @_;
my $content = '';
if (!defined $obj) {
return $content;
}
if (!defined $indent) {
$indent = ' ';
}
my $type = ref $obj;
if (!defined $type || $type eq '' || $type eq 'SCALAR') {
$content = $content . $indent . $obj . "\n";
}
elsif ($type eq 'ARRAY') {
foreach my $node (@$obj) {
$content = $content . objdump($node, $indent);
}
}
else {
my $key;
my $value;
while (($key, $value) = each %$obj) {
my $type2 = ref $value;
if (!defined $type2 || $type2 eq '' || $type2 eq 'SCALAR') {
$content = $content . $indent . "\'$key\' => $value;\n";
}
else {
$content = $content . $indent . "\'$key\' => {\n";
$content = $content . objdump($value, $indent.' ');
$content = $content . $indent . "}\n";
}
}
}
return $content;
}</port></hostname></port></hostname></arxschedule></password></user></url></port></hostname></port></hostname></port></hostname></arxschedule></password></user></url>