Forum Discussion

davmec_127271's avatar
davmec_127271
Icon for Nimbostratus rankNimbostratus
Nov 12, 2004

problem using LocalLB.Pool.add_member

Hi!

 

 

I have been trying this code without success (no node added to the pool)

 

 

    
   use SOAP::Lite + trace => qw(method debug);   
   use iControlTypeCast;   
      
   $Pool = SOAP::Lite   
     -> uri('urn:iControl:LocalLB/Pool')   
     -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");   
      
   $thepool = "NWG_WAP2";   
   $node = {address => "10.200.16.51", port => 8080};   
   $soapResponse = $Pool->add_member           
   (            
     SOAP::Data->name(pool_names => [$thepool]),   
     SOAP::Data->name(members => [$node])->type("IPPortDefinition"')                       
   &checkResponse($soapResponse);   
  

 

 

Then the command line output looked like this (sorry for the length):

 

 

    
   SOAP::Transport::new: ()   
   SOAP::Serializer::new: ()   
   SOAP::Deserializer::new: ()   
   SOAP::Parser::new: ()   
   SOAP::Lite::new: ()   
   SOAP::Transport::HTTP::Client::new: ()   
   SOAP::Transport::new: ()   
   SOAP::Serializer::new: ()   
   SOAP::Deserializer::new: ()   
   SOAP::Parser::new: ()   
   SOAP::Lite::new: ()   
   SOAP::Transport::HTTP::Client::new: ()   
   SOAP::Transport::new: ()   
   SOAP::Serializer::new: ()   
   SOAP::Deserializer::new: ()   
   SOAP::Parser::new: ()   
   SOAP::Lite::new: ()   
   SOAP::Transport::HTTP::Client::new: ()   
   SOAP::Data::new: ()   
   SOAP::Data::new: ()   
   SOAP::Lite::call: ()   
   SOAP::Serializer::envelope: ()   
   SOAP::Serializer::envelope: add_member SOAP::Data=HASH(0x1dba998) SOAP::Data=HAS   
   H(0x1dbb948)   
   SOAP::Data::new: ()   
   SOAP::Data::new: ()   
   SOAP::Data::new: ()   
   SOAP::Data::new: ()   
   SOAP::Data::new: ()   
   SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x1dc8a80)   
   SOAP::Transport::HTTP::Client::send_receive: POST https://10.20.69.240:443/iCont   
   rol/iControlPortal.cgi   
   Accept: text/xml   
   Accept: multipart/*   
   Content-Length: 933   
   Content-Type: text/xml; charset=utf-8   
   SOAPAction: "urn:iControl:LocalLB/Pooladd_member"   
      
  -?xml version="1.0" encoding="UTF-8"?>  
  -SOAP-ENV:Envelope  
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"  
    xmlns:namesp3="http://namespaces.soaplite.com/perl"  
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"  
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"  
    xmlns:namesp2="http://xml.apache.org/xml-soap"   
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">  
    -SOAP-ENV:Body>  
      -namesp1:add_member  
        xmlns:namesp1="urn:iControl:LocalLB/Pool">  
        -pool_names xsi:type="SOAP-ENC:Array"  
          SOAP-ENC:arrayType="xsd:string[1]">  
          -item xsi:type="xsd:string">N  
            WG_WAP2  
          -/item>  
        -/pool_names>  
        -members xsi:type="namesp3:IPPortDefinition"  
          SOAP-ENC:arrayType="namesp2:SOAPStruct[1]">  
          -item xsi:type="namesp2:SOAPStruct">  
            -address xsi:type="xsd:string">10.200.16.51-/address>  
            -port xsi:type="xsd:int">8080-/port>  
          -/item>  
        -/members>  
      -/namesp1:add_member>  
    -/SOAP-ENV:Body>  
  -/SOAP-ENV:Envelope>   
   SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x20131c0)   
   SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error   
   Connection: close   
   Date: Fri, 12 Nov 2004 20:51:21 GMT   
   Server: Apache   
   Content-Type: text/xml; charset="UTF-8"   
   Client-Date: Fri, 12 Nov 2004 10:57:45 GMT   
   Client-Peer: 10.20.69.240:443   
   Client-Response-Num: 1   
   Client-SSL-Cert-Issuer: /C=--/ST=WA/L=Seattle/O=MyCompany/OU=1099665699/CN=local   
   host.localdomain/emailAddress=root@localhost.localdomain   
   Client-SSL-Cert-Subject: /C=--/ST=WA/L=Seattle/O=MyCompany/OU=1099665699/CN=loca   
   lhost.localdomain/emailAddress=root@localhost.localdomain   
   Client-SSL-Cipher: DHE-RSA-AES256-SHA   
   Client-SSL-Warning: Peer certificate not verified   
   Client-Transfer-Encoding: chunked   
   SOAPServer: EasySoap++/0.6   
      
   -SOAP-ENV:Envelope   
           xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"   
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">   
   -SOAP-ENV:Body>   
   -SOAP-ENV:Fault>   
   -faultcode xsi:type="xsd:string">SOAP-ENV:Server-/faultcode>   
   -faultstring xsi:type="xsd:string">  
      Could not find element by name: address  
   -/faultstring>   
   -/SOAP-ENV:Fault>   
   -/SOAP-ENV:Body>   
   -/SOAP-ENV:Envelope>   
      
   SOAP::Deserializer::deserialize: ()   
   SOAP::Parser::decode: ()   
   SOAP::SOM::new: ()   
   SOAP-ENV:Server Could not find element by name: address   
   SOAP::Data::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Parser::DESTROY: ()   
   SOAP::Transport::DESTROY: ()   
   SOAP::Transport::HTTP::Client::DESTROY: ()   
   SOAP::Serializer::DESTROY: ()   
   SOAP::Deserializer::DESTROY: ()   
   SOAP::Parser::DESTROY: ()   
   SOAP::Transport::DESTROY: ()   
   SOAP::Transport::HTTP::Client::DESTROY: ()   
   SOAP::Serializer::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Data::DESTROY: ()   
   SOAP::Deserializer::DESTROY: ()   
   SOAP::Transport::HTTP::Client::DESTROY: ()   
   SOAP::Parser::DESTROY: ()   
   SOAP::Transport::DESTROY: ()   
   SOAP::Serializer::DESTROY: ()   
   SOAP::Deserializer::DESTROY: ()   
   SOAP::SOM::DESTROY: ()   
   SOAP::Lite::DESTROY: ()   
   SOAP::Lite::DESTROY: ()   
   SOAP::Lite::DESTROY: ()   
  

 

 

Do you know about why this error comes:

 

 

SOAP-ENV:Server Could not find element by name: address

 

 

The parameter seems to be parsed in:

 

 

    
  -members xsi:type="namesp3:IPPortDefinition"  
    SOAP-ENC:arrayType="namesp2:SOAPStruct[1]">  
    -item xsi:type="namesp2:SOAPStruct">  
      -address xsi:type="xsd:string">10.200.16.51-/address>  
      -port xsi:type="xsd:int">8080-/port>  
    -/item>  
  -/members>   
  

 

 

Thanks in advance for your help!

 

 

David
  • David, the signature for the add_members methods is the following

     

     

    void add_member(  
          in String[] pool_names,  
          in IPPortDefinition[][] members  
      );

     

     

    The idea is that you pass in a single dimensional array of pool_names and then a 2 dimensional array of members, 1 for each pool. This way you can add "n" different members for "m" pools. If the members parameter was a single dimensional array, it would add the list of members to all of the pools and more than likely that's not what would be wanted.

     

     

    So, looking at your code:

     

     

    $thepool = "NWG_WAP2";   
      $node = {address => "10.200.16.51", port => 8080};   
      $soapResponse = $Pool->add_member   
      (   
        SOAP::Data->name(pool_names => [$thepool]),   
        SOAP::Data->name(members => [$node])->type("IPPortDefinition")  
      );   
      &checkResponse($soapResponse);

     

     

    it is passing in a single dimensional array for the members variable. Change your code to the following and you should be set.

     

     

    my @pool_list = @_;  
      $member = {address => "10.200.16.51", port => 8080};     
      @members = ( [ $member ] );  Create Array of Array  
      $soapResponse = $Pool->add_member  
      (  
        SOAP::Data->name(pool_names => [@pool_list]),  
        SOAP::Data->name(members => [@members])  
      );

     

     

    Check out this link (http://www.perldoc.com/perl5.8.4/pod/perllol.html) on perldoc.com about arrays of arrays. (I always get a chuckle out of this URL. The perl doc folks obviously have a sense of humor)...

     

     

    -Joe