Forum Discussion
zak_thompson_86
Nimbostratus
Jan 22, 2008add_address_class_member.. not adding?
So using php and soap.
I can grab the classes display them. print ou their contents. all good.. but however.. can't add anything..
try {
$client = new SoapClient($wsdl,array('location'=>$location,'login'=>$username,'password'=>$password));
$pool_list=$client->get_address_class_list();
$classOpt = array('name' => 'testblock');
print_r($client->get_address_class($classOpt));
$addBlock = array('address' => '21.1.1.1','netmask' => '255.255.255.255');
$doIt = array('name' => $classOpt,'members' => $addBlock);
try {
$client->add_address_class_member("asfasdfasdf");
}
catch (Exception $k)
{
echo "ARG!";
echo $k->getMessage();
}
//print_r($pool_list);
}
catch (Exception $e) {
echo "Error!
";
echo $e -> getMessage ();
}No exceptions on failure nothing been beating it around for a while with little luck.
3 Replies
- The issue you are having is that the add_address_class_member takes an array of structures defining the address class entries you want to add. You are passing in a scalar string. The server is looking for an array and when you pass a scalar, the array conversion doesn't find an array definition and interprets it as an empty array and essentially performs a no-op.
The add_address_class_member() method is defined as:struct LocalLB::Class::AddressEntry { string address; string netmask; }; struct LocalLB::Class::AddressClass { string name; AddressEntry [] members; }; LocalLB::Class::add_address_class_member( in LocalLB::Class::AddressClass [] class_members );
You will need to package up and array of AddressClass items, one for each Class you are adding addresses to. Within each of those AddressClass items, you'll need to include an array of AddressEntry structures that contain the address and netmasks of the entries you want to add.
It looks like you are building the arrays, but in your call to add_address_class_member() you are passing in a character string.
Hope this helps...
-Joe - zak_thompson_86
Nimbostratus
yeah.. no real idea what your talking about tried making a new object using $client->AddressClass but thats not valid.. no real idea how to accomplish this to be honest. - What exactly don't you understand about what I'm talking about?
In your code, it looks like you are creating the structures, but your call to add_address_class_member() is this:$client->add_address_class_member("asfasdfasdf");
Why are you passing in "asfasdfasdf"? I would try passing in the array you created$client->add_address_class_member($doIt);
Again, since I have very little PHP experience, I'm just guessing, but give it a shot and see if it converts itself to the correct SOAP message.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects