Forum Discussion
May 03, 2011
This is a very common mistake when dealing with the loosely typed languages like Perl and Python.
Your problem is that the second parameter for the remove_wideip_pool() and add_wideip_pool() methods are a 2-d array and you are passing in a scalar value. The method signatures are
GlobalLB.WideIP.add_wideip_pool(
in String [] wide_ips,
in GlobalLB__WideIP__WideIPPool [] [] wideip_pools
)
GlobalLB.WideIP.remove_wideip_pool(
in String [] wide_ips,
in GlobalLB__WideIP__WideIPPool [] [] wideip_pools
)
The methods are designed to allow you to work on multiple wideips in a single call. And for each wideip, you have a list of pools you can add/remove.
You are calling the methods as if they were like:
GlobalLB.WideIP.add_wideip_pool(
in String [] wide_ips,
in GlobalLB__WideIP__WideIPPool wideip_pools
)
GlobalLB.WideIP.remove_wideip_pool(
in String [] wide_ips,
in GlobalLB__WideIP__WideIPPool wideip_pools
)
On the server, we iterate through each of the wide_ips in the first parameter and then extract the list from the second parameter's associated 1-degree index. In your case, the second parameter isn't an array so it's treated as an array of size zero so it's essentially a no-op on the server. The same as if you passed in an empty size array.You are going to have to create a 2-D array something like this:
Now for the scary part.
Remove the pool...
my $oldPoolObj = $poolObj;
my @oldPoolObjA;
push @oldPoolObjA, $oldPoolObj;
my @oldPoolObjAofA;
push @oldPoolObjAofA, [@oldPoolObjA];
$soapResponse = $GlobalPoolMember->remove_wideip_pool
(
SOAP::Data->name('wide_ips' => [$sWip]),
SOAP::Data->name('wideip_pools' => [@oldPoolObjAofA]),
);
&checkResponse($soapResponse);
Edit our pool object with the new settings
$poolObj->{'ratio'} = $sRatio;
my @newPoolObjA;
push @newPoolObjA, $poolObj;
my @newPoolObjAofA;
push @newPoolObjAofA, [@newPoolObjA];
Re-add it with the appropriate settings.
$soapResponse = $GlobalPoolMember->add_wideip_pool
(
SOAP::Data->name('wide_ips' => [$sWip]),
SOAP::Data->name('wideip_pools' => [@newPoolObjAofA]),
);
&checkResponse($soapResponse);
In the trace, you should now see the wideip_pools parameter as a 2-d array.
This hasn't been tested, but I think it'll get you where you want to go. Let me know if you are still stuck after this.
-Joe