Forum Discussion

nevetS_66718's avatar
nevetS_66718
Icon for Nimbostratus rankNimbostratus
Dec 18, 2007

Perl Development FAQ

I've run into a few problems with my development that it took me a while to track down, so I decided to share my solutions:

1) How do I remove warnings from iControlTypeCast.pm

There are a couple of problems with this example. Some warnings are a result of using potentially undefined variables in the deserializer if statement.

Update:


if (defined ($urnMap->{$type}))

to


if ( defined ($urnMap) && defined ($type) && defined ($urnMap->{$type}))

This gets rid of most warnings, but you will still get something similar to:

Subroutine SOAP::Deserializer::typecast redefined

This warning can be removed by wrapping the subroutine in a BEGIN block with "no warnings" declared.


BEGIN{
no warnings;
  sub SOAP::Deserializer::typecast
  {
...
   }
}

2) I'm passing correct data, but I am still seeing SOAP errors. How do I fix this?

You may be passing the right data, but the format that you are sending may be incorrect. Try the following.


$param = SOAP::Data->name(variable_name)->value(variable_value);

3) It sure would be nice to see the raw xml output of my transactions. How can I get more information about what's going on behind the scenes?

There are a couple of things to do. You can set the outputxml flag for a particular SOAP::Lite object by doing this:


$SoapObject->outputxml(1);

You can also try this as part of your use statement:


use SOAP::Lite ( outputxml => 1, );

Or even better (but much more verbose):


use SOAP::Lite +trace => 'all', readable => 1, outputxml => 1;

4) I only have operator access to a specific partition on the F5. Many of the sample scripts don't seem to work.

The default partition that is used is "Common". If you need to access a different partition, you have to set the active partition:


my $Partition = SOAP::Lite
  -> uri('urn:iControl:Management/Partition')
  -> proxy("https://yourBigIP/"."/iControl/iControlPortal.cgi");
$Partition->transport->http_request->header
  (
  'Authorization' => 
  'Basic ' . MIME::Base64::encode($user.":".$password, '')
  ); 
my $results = $Partition->set_active_partition(
  SOAP::Data->name('active_partition')->value(thenameofyourpartition)
);

I hope these snippets prove useful for others. Thanks to Joe for helping get me going.

Thanks,

Steve Kallestad

(http://www.stevekallestad.com)

Obviously, I welcome any corrections and additions.

2 Replies

  • Very cool! Thanks for passing along your war pains. I'll go ahead and make a wiki topic for this in the iControl wiki so folks can build on to it.

     

     

    -Joe
  • Here's the new wiki topic:

     

     

    http://devcentral.f5.com/Wiki/default.aspx/iControl/PerlDevelopmentFAQ.html

     

    Click here

     

     

     

    Thanks again!

     

     

    -Joe