Forum Discussion
GavinW_29074
Apr 26, 2012Nimbostratus
Posted By Ross on 04/26/2012 05:34 AM
Hehe, I know what you mean, I've done the same several times.
Not sure on closing icontrol sessions, I generally dont. But then if you are changing active partitions/folders you may find that this persists if you dont close the session appropriately. (I've not looked into it too deeply, but have found a few instances where set_active_partition appears to "stick" but that may be just me).
Cheers
Ross
Ross
Yeh, I was noticing the same thing when enabling the Recursive flag...
Was looking through the SDK and couldn't find a way of 'logging out' or invalidating the session though, unless I missed something...
Another question then, and this again relates to the Recursive flag...
Is there a way that I can temporarily change the URI that a SOAP::Lite handler is using without having to change it back again?
I.e. Currently I've got the following code block which handles setting of the recursive flag, and I'm having to set the URI after updating the recursive flag. This is fine in this scenario, but could prove awkward when constantly switching between URI's...
sub createHandler ($$)
{
my ($urn,$recursive) = (@_);
Set-up variable
my ($handler);
if ($recursive)
{
$handler = SOAP::Lite
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $handler->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
Set recursive
&setRecursive($handler);
Correct Handler URI path.
$handler->uri($urn);
} else {
$handler = SOAP::Lite
-> uri($urn)
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $handler->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
}
return $handler;
}
----------------------------------------------------------------------------
setRecursive - Set the Recursive Query State.
----------------------------------------------------------------------------
sub setRecursive ($$)
{
my ($handler) = (@_);
Switch to System/Session and Set recursive
$handler->uri('urn:iControl:System/Session')
->set_recursive_query_state(
SOAP::Data->name(state => "STATE_ENABLED")
);
return $handler;
}
Cheers
Gav