Paul_Lavoie_724
Dec 27, 2006Nimbostratus
Trouble with PoolMember->get_session_enabled_state in perl
Hi!
I'm starting to write perl scripts using the iControl API to replace some bigpipe shell scripts, and seem to have run into a problem.
The following application:
!/usr/bin/perl -w
use SOAP::Lite;
use MIME::Base64;
Variables for
our $sUID = 'user';
our $sPWD = 'password';
our $sProtocol = 'https';
our $sPort = 443;
initSOAPtoLB('devbigip1');
sub initSOAPtoLB ($) {
my ($sHost) = shift; Name of load balancer...
my $Pool = SOAP::Lite->uri('urn:iControl:LocalLB/Pool')
->proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $Pool->transport->http_request->header(
'Authorization' => 'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
my $PoolMember = SOAP::Lite->uri('urn:iControl:LocalLB/PoolMember')
->proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $PoolMember->transport->http_request->header(
'Authorization' => 'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
my $resp = $Pool->get_list;
checkResponse($resp);
my @poolList = @{$resp->result};
my @sess = undef;
foreach my $p (@poolList) {
print "$p\n";
my $resp2 = $PoolMember->get_session_enabled_state
(
SOAP::Data->name(pool_names => [$p])
);
eval {
checkResponse($resp2);
push(@sess, @{$resp2->result});
};
}
foreach my $s (@sess) {
print "$s\n";
}
return ($Pool, $PoolMember, \@poolList);
}
does not seem to handle the get_session_enabled_state method properly. The error output from the script is:
news_thin
Unrecognized type '{urn:iControl}Common.EnabledState'
xmlns:E="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:A="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.w3.org/2001/XMLSchema"
xmlns:iControl="urn:iControl"
E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
xmlns:m="urn:iControl:LocalLB/PoolMember">
s:type="A:Array"
A:arrayType="iControl:LocalLB.PoolMember.MemberSessionState[][1]">
A:arrayType="iControl:LocalLB.PoolMember.MemberSessionState[1]">
s:type="iControl:LocalLB.PoolMember.MemberSessionState">
s:type="iControl:Common.IPPortDefinition">
s:type="y:string">10.72.170.75
s:type="y:long">10428
s:type="iControl:Common.EnabledState">STATE_ENABLED
at ./testiCtrl.pl line 136
which to me looks like a definition error within iControl. Any suggestions?