Forum Discussion

Dave_Wiley's avatar
Dave_Wiley
Icon for Nimbostratus rankNimbostratus
Jul 02, 2008

Error with Get_Enabled_State

I’m hoping all you iControl experts can help me out with this request, or at least point me in the right direction. I’m getting an unexpected response when trying to pull the state of a virtual via iControl. I checked the SDK Help and I see to access this method it’s under “LocalLB.VirtualServer.get_enabled_state.” I’m using this same object $VirtualServer to access other values without problem (port, ip, mask). I’m writing this in Perl and I cannot find an example with this method on devcentral. The java version just shows a stub, but doesn’t show how it’s defined (http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=217).

 

 

I’ve tried to guess a few different urn combinations, but I haven’t found any success. When guessing I’m not having much success, I’m getting thrown “500 Can't locate HTML/HeadParser.pm.”

 

 

here’s where I define the $VirtualServer

 

$VirtualServer = SOAP::Lite

 

-> uri('urn:iControl:LocalLB/VirtualServer')

 

-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");

 

eval { $VirtualServer->transport->http_request->header

 

(

 

'Authorization' =>

 

'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')

 

); };

 

 

 

and when I make this call, this is where it’s failing

 

sub getState()

 

{

 

my ($virtual_name) = (@_);

 

$soapResponse = $VirtualServer->get_enabled_state <= failing on this line

 

(

 

SOAP::Data->name(virtual_servers => [$virtual_name])

 

);

 

&checkResponse($soapResponse);

 

@stateArray = @{$soapResponse->result};

 

print "TEST : $stateArray[0] \n";

 

$state = $stateArray[0];

 

}

 

 

And I’m getting thrown:

 

Unrecognized type '{urn:iControl}Common.EnabledState'

 

xmlns:E="http://schemas.xmlsoap.org/soap/envelope/"

 

xmlns:A="http://schemas.xmlsoap.org/soap/encoding/"

 

xmlns:s="http://www.w3.org/2001/XMLSchema-instance"

 

xmlns:y="http://www.w3.org/2001/XMLSchema"

 

xmlns:iControl="urn:iControl"

 

E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

 

 

xmlns:m="urn:iControl:LocalLB/VirtualServer">

 

s:type="A:Array"

 

A:arrayType="iControl:Common.EnabledState[1]">

 

STATE_ENABLED

 

 

 

 

 

 

Thanks In Advance!

 

 

Dave

 

1 Reply

  • The "Unrecognized Type" error is SOAP::Lite telling you that a custom type is returned that you have not added a custom serializer for. In the SDK, I've included a iControlTypeCast.pm module that contains all the custom enum types and the serializer for them. If you don't want the overhead of the entire iControlTypeCast.pm module, you can add the typecast code yourself by putting this somewhere in your script.

     

     

    ---------------------------------------------------------------------------- 
      support for custom enum types 
     ---------------------------------------------------------------------------- 
     sub SOAP::Deserializer::typecast 
     { 
       my ($self, $value, $name, $attrs, $children, $type) = @_; 
       my $retval = undef; 
       if ( "{urn:iControl}Common.EnabledState" == $type ) 
       { 
         $retval = $value; 
       } 
       return $retval; 
     }

     

     

    -Joe