Forum Discussion

paul_adomeit_70's avatar
paul_adomeit_70
Icon for Nimbostratus rankNimbostratus
Jan 08, 2007

query_pool_associations does not return anything

Here's a sample of the code I'm using. I stripped all the faultcode checking for now.

 

The credentials, host, port etc are set elsewhere. The soap response returns an empty array. I've tried a few different rules on two different big-ip's (both running v4.5.14) and got the same result. I'm using v4.6.3 of iControl.

 

 

I included some of the debug messages.

 

 

1. The rule does exist (text is 'use pool test')

 

2. The request is using the "rule_names" parameter and is a string"

 

3. Big-IP responds with a 200 OK so I'm in the right ball park

 

4. The response come back with an empty array

 

 

 

----------------------------------------------------------------------------

 

Get pools used by rule

 

----------------------------------------------------------------------------

 

sub get_pools_used_by_rule

 

{

 

$soap1 = SOAP::Lite

 

-> uri('urn:iControl:ITCMLocalLB/Rule')

 

-> readable(1)

 

-> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");

 

 

$soap1_response = $soap1->query_pool_associations(SOAP::Data->name(rule_names => "sample"));

 

print "pool is ".$soap1_response->result." \n";

 

}

 

 

 

Here's a few debug statements:

 

(what the client is going to do)

 

SOAPAction: "urn:iControl:ITCMLocalLB/Rulequery_pool_associations"

 

 

(what is sent)

 

>

 

>

 

>

 

>sample

 

 

 

The reponse....

 

SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x55fa34c)

 

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK

 

 

 

 

Here's the soap body in the response:

 

 

xmlns:m="urn:iControl:ITCMLocalLB/Rule">

 

s:type="A:Array"

 

A:arrayType="A:Array[0]"/>

 

 

 

 

  • Hi Joe,

     

    Putting the brackets around the rule name did coerce the literal into an array for the request (emboldened with success, I tried to put brackets around my kids to coerce them into the bathtub but they core dumped and became unresponsive). Big-ip did respond correctly with a mutli-dimensional array with the pool names. So far, so good.

     

     

    I spent the next hour or so with my copy of "Learning Perl" trying to tease the results out and came up with nothing that worked but many examples that completely failed. I searched the internet. The last thing I remember was being at www.prsguitars.com wondering if anyone at home would notice if a Custom 24 showed up.

     

     

    Could you show me a quick example on how to extract the first index in the 1st dimension (rule_name) and then use it to return the first entry in the 2nd dimension (a pool name)? Once I know the basic syntax to at least get at the values, I can take it from there to build the loops to iterate the arrays. I'll post the final snip of code when it's done.

     

     

    Thanks!

     

    -p
  • We have a winner.

     

    Thanks Joe!

     

     

     

    ----------------------------------------------------------------------------

     

    Get pools used by rule

     

    ----------------------------------------------------------------------------

     

    sub get_pools_used_by_rule

     

    {

     

    Routine makes soap call and iterates over values to extract pool names

     

     

    $soap1 = SOAP::Lite

     

    -> uri('urn:iControl:ITCMLocalLB/Rule')

     

    -> readable(1)

     

    -> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");

     

     

    $soap1_response = $soap1->query_pool_associations(SOAP::Data->name(rule_names => [$rule]));

     

     

    if ( $soap1_response->fault )

     

    {

     

    print $soap1_response->faultcode, "(faultstring) ", $soap_response->faultstring, "\n";

     

    print $soap1_response->faultcode, "(faultdetail) ", $soap_response->faultdetail, "\n";

     

    }

     

    else

     

    {

     

    my @poolAofA = @{$soap1_response->result};

     

    for my $i (0..$poolAofA)

     

    {

     

    print "rule $i: \n";

     

    my $pool_list = $poolAofA[$i];

     

    foreach my $pool_name ( @{$pool_list} )

     

    {

     

    print " $pool_name \n";

     

    }

     

    }

     

     

    }

     

    }