Forum Discussion

mfreeman451_606's avatar
mfreeman451_606
Icon for Nimbostratus rankNimbostratus
Apr 15, 2009

Question on KeyCertificate / Perl API (SOAP)

I'm trying to do stuff with KeyCertificate, specifically certificate_delete. It is supposed to take two options, mode and cert_ids

 

 

 

 

I'm getting this error:

 

 

$VAR1 = 'cert_ids';

 

$VAR2 = 'www.mfreeman.com';

 

$VAR3 = 'mode';

 

$VAR4 = 'MANAGEMENT_MODE_DEFAULT';

 

Error: SOAP-ENV:Server - SOAP response Could not find element by name: mode

 

Bad SOAP response! at /mnt/netapp/scripts/NTW-Dev-Tools/Lib/BB/F5/iControl/SSL.pm line 154.

 

 

I'm calling it like this:

 

 

 

my $soapResponse = $keyCert->certificate_delete(

 

SOAP::Data->name( %args )

 

);

 

 

where %args =

 

mode => MANAGEMENT_MODE_DEFAULT

 

cert_ids => www.mfreeman.com

 

 

Any idea what I'm doing wrong here?

 

 

5 Replies

  • my $soapResponse = $keyCert->certificate_delete(

     

    SOAP::Data->name( mode => $args{'mode'} ),

     

    SOAP::Data->name( cert_ids => $args{'cert_ids'} )

     

    );

     

     

    so that fixed it.. I guess I need to do that everytime one of these methods takes multiple arguments? that seems sub-optimal.

     

  • now after I delete www.mfreeman.com it still shows up when I do get_certificate_list, I thought these operations were all atomic?
  • my $soapResponse = $keyCert->certificate_delete(

     

    SOAP::Data->name( mode => $args{'mode'} ),

     

    SOAP::Data->name( cert_ids => [$args{'cert_ids'}] )

     

    );

     

     

    ah HA! awesome.. working now..
  • The prototype for the certificate_delete method is the following:

    Management::KeyCertificate::certificate_delete(

    in ManagementModeType mode,

    in String [] cert_ids

    );

    You are passing in a literal for the cert_ids parameter but the iControl portal is expecting a string array. The default processing is to treat string literals as zero sized arrays (not sure why this is, but it is) so your method invocation is being treated like a no-op.

    You'll want to coerce your literal into an array by surrounding it with brackets.

    my $soapResponse = $keyCert->certificate_delete(  
       SOAP::Data->name( mode => $args{'mode'} ),  
       SOAP::Data->name( cert_ids => [$args{'cert_ids'}] )  
     );

    And that should take care of it for you.

    As for your previous question about using a single SOAP::Data to pass in your $args variable, the SOAP::Lite client toolkit requires you to use a separate SOAP::Data parameter for each inbound parameter. I'm not a big perl guru but if you can dig through the Lite.pm module and see why that is and report back here, we'd appreciate it!

    Anyways, hope this helps and let us know if anything else comes up.

    -Joe
  • Oh well, looks like you found the solution as I was typing. Glad you've got things working...

     

     

    -Joe