Hello:
Unfortunately the eval trick doesn't work in this occasion. Since I am calling the saveConfiguration subroutine, I modified it as follows:
sub saveConfiguration()
{
my ($configName, $saveMode, $quiet) = (@_);
my $success = 0;
if ( ("" eq $configName) or ("" eq $saveMode) )
{
&usage("save");
}
I Changed this to be an eval statement
eval { $soap_response = $ConfigSync->save_configuration
(
SOAP::Data->name(filename => $configName),
SOAP::Data->name(save_flag => $saveMode)
); };
This is the part I added
if ( $@ )
{
print "ERROR: $@\n"; exit;
}
if ( $soap_response->fault )
{
if ( 1 != $quiet )
{
print $soap_response->faultcode, " ", $soap_response->faultstring, "\n";
}
}
else
{
$success = 1;
if ( 1 != $quiet )
{
print "Configuration '$configName' saved successfully!\n";
}
}
return $success;
}
ERROR: 401 F5 Authorization Required at f5DeviceBackup.pl line 662.
Line 662 corresponds to
eval { $soap_response = $ConfigSync->save_configuration
In this setup, I had the auth check error disabled.
----------------------------------------------------------------------------
Transport Information
----------------------------------------------------------------------------
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
print "SOAP::Transport::HTTP::Client::get_basic_credentials($sUID, $sPWD)\n";
return "$sUID" => "$sPWD";
}
$ConfigSync = SOAP::Lite
-> uri('urn:iControl:System/ConfigSync')
-> readable(1)
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $ConfigSync->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
if ($@)
{
print "Authentication to $sHost failed\n";
exit;
}
This is the part commented out
if ($ConfigSync->fault)
{
print "Authentication failed\n";
}
If I changed it back to how it was originally.
----------------------------------------------------------------------------
Transport Information
----------------------------------------------------------------------------
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
print "SOAP::Transport::HTTP::Client::get_basic_credentials($sUID, $sPWD)\n";
return "$sUID" => "$sPWD";
}
$ConfigSync = SOAP::Lite
-> uri('urn:iControl:System/ConfigSync')
-> readable(1)
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $ConfigSync->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
if ($@)
{
print "Authentication to $sHost failed\n";
exit;
}
if ($ConfigSync->fault)
{
print "Authentication failed\n";
}
&checkParameters();
exit;
Code still exits prematurely.
401 F5 Authorization Required at f5DeviceBackup.pl line 174
where line 174 is "if ($ConfigSync->fault)"
sounds like evaluating any calls with the ConfigSync object simply fails.
I am going to read more on the SOAP::Lite module.
Regards,
Luke Yildirim