Forum Discussion

RoutingLoop_179's avatar
May 29, 2013

Can't create datagroup file using LocalLB::DataGroupFile::create

Hi I'm having issues creating a new datagroup file using LocalLB::DataGroupFile::create(). SOAP API seems to call ok and does not return any exceptions however the new file does not get created on the LTM following completion. I'm using perl and tested this against both LTM 11.2 and 11.3 (although we run 11.2 in production)

 

I have tested using other datagroupfile functions e.g set_local_path and get_list and they all seem to work as expected, it just seems I can't get create to work. Hopefully someone can point out what i've been doing wrong.

 

my create subroutine.

 

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

 

sub create datagroupfile

 

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

 

 

 

sub createDataGroupFile()

 

{

 

my ($Identifier,$path,$type) = (@_);

 

 

print "$Identifier, $path, $type\n";

 

 

$soapResponse = $datagroupfile->create

 

(

 

SOAP::Data->name(files => $Identifier),

 

SOAP::Data->name(paths => $path),

 

SOAP::Data->name(types => $type)

 

);

 

&checkResponse($soapResponse);

 

 

print "DataGroupFilename $Identifier successfully created with file $path and type $type\n";

 

 

}

 

 

Any help or guidence greatly appreciated.

 

 

4 Replies

  • I've tried to enable debug on BIGIP and SOAP - neither seem to show me anything obvious. BIGIP /var/log/ltm see's the call for LocalLB:DataGroupFile::create

     

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: Portal: User: admin, Folder: /Common

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:DataGroupFile::create called by user "admin"

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: Portal: User: admin, Folder: /Common

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:DataGroupFile::get_list called by user "admin"

     

    May 29 15:51:33 bigip-wl1 debug iControlPortal.cgi[10388]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

  • Sine you didn't show how you defined your parameters, I'm assuming that they are all scalar values (single strings). The method takes in all parameters as arrays. SOAP::Lite doesn't do auto-conversion of scalars to arrays for you so it's going to just pass in an array size of zero for all parameters. In perl, the easiest way is force a conversion is to wrap the parameters with brackets to tell SOAP::Lite to encode it as an array. Something like this should work

     

    $soapResponse = $datagroupfile->create (

     

    SOAP::Data->name(files => [$identifier]),

     

    SOAP::Data->name(paths => [$path]),

     

    SOAP::Data->name(types => [$type])

     

    );

     

    A good way to debug with SOAP::Lite it so turn on client-side debugging with:

     

    use SOAP::Lite + trace => qw(method debug);

     

    That will print to the console the entire SOAP request and responses which should have shown the parameters weren't encoded as arrays.

     

    Hope this helps...

     

    -Joe

     

  • Thanks Joe, Yes sorry in the case of my testing I've just been passing scalar strings. I have actually tried square brackets previously and it gives back an exception of Common::InvalidArgument for types. I'll have a look using the debug tomorrow as to why it might be as not in the office now. An example of the parameters i'm passing to the subroutine are:

     

    files as a string e.g "wl-datagroup-1", (i've tried specifically stating the partition i.e /Common/wl-datagroup-1)

     

    paths as a string e.g "filename", (i've used full path and/or relative path location)

     

    types as integer e.g 2 for string datagroup (i've also tried the datagrouptype member name e.g DATA_GROUP_STRING)

     

     

    as i said if types is set as an integer then wrapped in square brackets it gives an InvalidArgument exception.

     

     

    Thanks for you help, I'll have a another look to what i've done wrong tomorrow. I'll post my whole script too.

     

  • Awesome thanks Joe - figured it out. As you said it needs to wrapping in brackets to pass it as an array. But for datagroup type argument i assumed you used the value and not the member name, obviously when i tried the member name previously I must have not tried it with the brackets.