Forum Discussion

Omachonu_Ogali1's avatar
Omachonu_Ogali1
Historic F5 Account
Dec 20, 2006

Can't disable a pool member via PHP/SOAP+WSDL

I'm trying to disable a pool member, but not having any luck. I've called both the set_monitor_state() and set_session_enabled_state() functions, but the member is never disabled.

 

 

Is there anything additional I should be doing?

 

 

case 'disable':

 

if ($obj->enabled_status == ENABLED_STATUS_DISABLED) {

 

printf("%s:%d is already disabled in pool %s\n", $member->address, $member->port, $current_pool);

 

} else {

 

printf("disabling %s:%d in pool %s\n", $member->address, $member->port, $current_pool);

 

$pm_ctrl->set_monitor_state(array($current_pool), array(member => $member, monitor_state => STATE_DISABLED));

 

$pm_ctrl->set_session_enabled_state(array($current_pool), array(member => $member, session_state => STATE_DISABLED));

 

}

 

break;

 

  • I haven't used the PHP interface and don't know the language so well, but what I do see is that you are passing in a 1-D array for the first parameter and a 1-D array for the second parameter.

    The signature for set_session_enabled_state() is as follows:

    struct MemberSessionState {
      IPPortDefinition member;
      EnabledState session_state;
    };
    void LocalLB::PoolMember::set_session_enabled_state(
        in String[] pool_names,
        in MemberSessionState[][] session_states
    );

    You'll need to pass in a 1-D array for the pool_names parameter and a 2-D array for the session_states structures (the first dimension equates to each pool in the pool_names list, the second dimension is for all of the pool members in that given pool).

    Sorry I can't be more help. Let us know when you get it working.

    Also, if you could come up with a HTTP trace of this call, that would also help in diagnosing what other issues might be.

    -Joe
  • Omachonu_Ogali1's avatar
    Omachonu_Ogali1
    Historic F5 Account
    I initially tried passing a 2-level array as the second argument, but I get an exception from iControl saying that the member object could not be found. If I do a 1-level array, it goes through without a problem, without any exceptions thrown.

     

     

    Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'member' property in /www/icontrol/cmdshow.php:181

     

    Stack trace:

     

    0 [internal function]: SoapClient->__call('set_session_ena...', Array)

     

    1 /www/icontrol/cmdshow.php(181): SoapClient->set_session_enabled_state(Array, Array)

     

    2 {main}

     

    thrown in /www/icontrol/cmdshow.php on line 181
  • Well, I can guarantee that it is in fact a 2-D array that is required. Odds are the reason why you aren't getting an error for a 1-D array is that the server code is looking at that 1-D array and treating it as an empty 2nd dimension, thus no members for the associated pools.

     

     

    I wish I could help more but since I have no practical knowledge of PHP and it's not a supported environment in our development kit, I'm kind of at a loss.

     

     

    Anyone out there with a PHP background have any insights?

     

     

    BTW, is there a proxy-generation phase (compiling the WSDL) of the PHP toolkit or is everything dynamic like it is in perl? I thought it was dynamic but your client SOAP error looks like it's looking for the "member" member of one of the input structures and I don't know how it would know about that name without some sort of pre-compilation.

     

     

    -Joe
  • Omachonu_Ogali1's avatar
    Omachonu_Ogali1
    Historic F5 Account
    I did some more testing, and even renamed my 1-D array keys to incorrect names (i.e. NOT member and monitor_state), and it still accepted the parameters without throwing an exception. It refuses a 2-D array, so I ended up creating a class and referencing that as an object. Now, it works flawlessly...

     

     

    class memberMonitorState {

     

    var $member;

     

    var $monitor_state;

     

     

    function __construct($member, $monitor_state) {

     

    $this->member = $member;

     

    $this->monitor_state = $monitor_state;

     

    }

     

    }

     

     

    ...

     

     

    case 'disable':

     

    if ($obj->enabled_status == ENABLED_STATUS_DISABLED) {

     

    printf("%s:%d is already disabled in pool %s\n", $member->address, $member->port, $current_pool);

     

    } else {

     

    printf("disabling %s:%d in pool %s\n", $member->address, $member->port, $current_pool);

     

     

    $session_disabled[0][0] = new MemberSessionState($member, STATE_DISABLED);

     

    $pm_ctrl->set_session_enabled_state(array($current_pool), $session_disabled);

     

    }

     

    break;

     

  • Omachonu_Ogali1's avatar
    Omachonu_Ogali1
    Historic F5 Account
    Never mind that last post, totally unnecessary. I was interpreting it as a 2-dimension array, when it's actually a 3-dimension array (first index is the pool, second index is the pool member, third is the actual value). No need for the classes and object references.