Forum Discussion

jj24_43946's avatar
jj24_43946
Icon for Nimbostratus rankNimbostratus
Jun 14, 2011

Help with LocalLB::VirtualServer/Create

Hi again, I'm trying to create a VirtualServer, but I'm gettting the following error: SOAP-ENV:Server Could not find element by name: profile_context Here's my profile part of the datastructure:

 

 

$VAR1 = {

 

'profile_name' => 'test_pool_VS',

 

'profile_context' => 'PROFILE_CONTEXT_TYPE_ALL'

 

};

 

 

Did I build that correctly? Here's my perl code to build the data structure:

 

 

my $protocol_type = 'PROTOCOL_TCP';

 

 

my $VirtualServerDefinition =

 

{

 

name => "Sitename_VS",

 

address => '10.10.10.254',

 

port => 80,

 

protocol => $protocol_type

 

};

 

 

my $VirtualServerType = 'RESOURCE_TYPE_POOL';

 

 

my $VirtualServerResource =

 

{

 

type => $VirtualServerType,

 

default_pool_name => 'Sitecode_B2C_http'

 

};

 

 

my $ProfileContextType = 'PROFILE_CONTEXT_TYPE_ALL';

 

 

my $VirtualServerProfile =

 

{

 

profile_context => $ProfileContextType,

 

profile_name => 'Sitecode_prod_http_VS'

 

};

 

 

my $VSDefinition =

 

{

 

definitions => $VirtualServerDefinition,

 

wildmasks => '',

 

resources => $VirtualServerResource,

 

profiles => $VirtualServerProfile

 

};

 

 

Any idea why I'm getting the profile_context error?

 

 

Thanks !
  • I'm not sure how you are passing the values into the actual create method so it's hard to predict what the exact problem is. Here's how I've done it in the past

    sub createVirtual()
    {
        $VirtualServerDefinition =
        {
            name => "Sitename_VS",
            address => "10.10.10.254",
            port => "0",  "80",
            protocol => "PROTOCOL_TCP"
        };
        $wildmask = "255.255.255.255";
        $VirtualServerResource =
        {
            type => "RESOURCE_TYPE_POOL",
            default_pool_name => "Sitecode_B2C_http"
        };
        $VirtualServerProfile =
        {
            profile_context => "PROFILE_CONTEXT_TYPE_ALL",
            profile_name => "Sitecode_prod_http_VS"
        };
        $soapResponse = $VirtualServer->create
        (
            SOAP::Data->name(definitions => [$VirtualServerDefinition]),
            SOAP::Data->name(wildmasks => [$wildmask]),
            SOAP::Data->name(resources => [$VirtualServerResource]),
            SOAP::Data->name(profiles => [[$VirtualServerProfile]])
        );
        &checkResponse($soapResponse);
        
        print "Virtual Server Created!\n"
        
    }

    Hope that helps...

    -Joe

  • It worked great. I thought I had done it the same, but looks like you have double brackets around the profile value for the soap submission. That must have been what did it. Thanks again!!
  • Anytime! I guess all those iControl samples I've written for the past 7 years are starting to pay off B-). BTW, the double brackets are to specify that that parameter is a 2-D array.

     

     

    -Joe