Forum Discussion

StainlessSteelR's avatar
StainlessSteelR
Icon for Nimbostratus rankNimbostratus
Feb 04, 2004

LBMethod

Hi there,

 

 

I'm trying to create a pool using the SOAP call 'create' in Java. The method signature from the iControl docs mentions the parameter lb_method which seems to want the LBMethod class.

 

void create( 
     in SessionCredentials creds,  <== CORBA Specific 
     in String pool_name, 
     in LBMethod lb_method, 
     in IPPortDefinition[] members 
 ); 
 

 

However, it doesn't seem to exist in the ITCMLocalLB package. I'm using the code below, but I get an invalid argument error message from the SOAP call. (I'm passing the lb_method parameter as an Integer instead of the LBMethod class.)

 

String urn = "urn:iControl:ITCMLocalLB/Pool"; 
     _call.setTargetObjectURI(urn); 
     _call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 
     _call.setSOAPMappingRegistry(_soap_registry); 
     _call.setMethodName("create"); // 
  
     IPPortDefinition[] ips = pool.getNodeIPs(); 
     Vector params = new Vector(); 
     params.addElement(new Parameter("pool_name", String.class, pool.getName(), null)); 
     params.addElement(new Parameter("lb_method", Integer.class, "0", null)); 
     params.addElement(new Parameter("members", IPPortDefinition[].class, ips, null)); 
  
     _call.setParams(params); 
 

 

Anybody got any ideas??

 

 

Cheers,

 

 

Stuart
  • Ok, now I'm getting a 'No Seralizer' error for the LBMethod class. So I'm guessing the classes in the support.SOAP.java.shared.ITCMLocalLB package are serializable and the classes in the com.f5.ITCM.ITCMLocalLB are not.

     

     

    Can anybody give me any clues where I'm going wrong......

     

     

    :? :? :?

     

     

    S.
  • Hey Joe, cheers for the reply.

     

     

    Here is my code...

     

     
         String urn = "urn:iControl:ITCMLocalLB/Pool"; 
         _call.setTargetObjectURI(urn); 
         _call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 
         _call.setSOAPMappingRegistry(_soap_registry); 
         _call.setMethodName("create"); // 
      
         IPPortDefinition[] ips = pool.getNodeIPs(); 
         Vector params = new Vector(); 
         params.addElement(new Parameter("pool_name", String.class, pool.getName(), null)); 
         params.addElement(new Parameter("lb_method", LBMethod.class, LBMethod.LB_METHOD_ROUND_ROBIN, null)); 
         params.addElement(new Parameter("members", IPPortDefinition[].class, ips, null)); 
      
         _call.setParams(params);

     

    The problem is that I can't find the LBMethod class in the ITCMLocalLB package.

     

     

    S.
  • Sorry I didn't catch this sooner, I haven't been in the java/SOAP code for quite a while...

     

     

    For v4.5 and below of the products, the LBMethod is implemented as an Integer (as are all enums). In the next version of our products we are fully supporting enum types.

     

     

    The correct use is the example from your first post where you declare the LBMethod as a Integer. Here's a code snippet to go by

     

     

    ... 
     Integer LB_METHOD_ROUND_ROBIN = 0; 
     Integer LB_METHOD_RATIO = 1; 
     Integer LB_METHOD_FASTEST = 2; 
     Integer LB_METHOD_RATIO_MEMBER = 3; 
     Integer LB_METHOD_LEAST_CONN_MEMBER = 4; 
     Integer LB_METHOD_OBSERVED_MEMBER = 5; 
     Integer LB_METHOD_PREDICTIVE_MEMBER = 6; 
     Integer LB_METHOD_OBSERVED_NODE_ADDR = 7; 
     Integer LB_METHOD_PREDICTIVE_NODE_ADDR = 8; 
     Integer LB_METHOD_DYNAMIC_RATIO = 9; 
      
     ... 
     params.addElement(new Parameter("lb_method", Integer.class, LB_METHOD_ROUND_ROBIN, null)); 
     ...

     

     

    Let us know if there is anything else we can help out with.

     

     

    -Joe
  • Ok, so I've just found it. I've been importing

     
     import support.SOAP.java.shared.*; 
     import support.SOAP.java.shared.ITCMCommon.*; 
     import support.SOAP.java.shared.ITCMLocalLB.*; 
     

    But I also needed to...

    import com.f5.ITCM.ITCMLocalLB.LBMethod;

    Whats the difference between the com.f5.ITCM.ITCMLocalLB and support.SOAP.java.shared.ITCMLocalLB ??

    Anybody know??

    S.
  • Great. Please let us know what kind of application you are working on. Understanding what our customers are doing help us make better products for the future!

     

     

    -Joe
  • The com.f5.* classes are for our CORBA clients so they won't do you much good if you are going the SOAP route. All the serializers should be included in the support/SOAP/java/shared directory. The LocalLBPool.java sample code illustrates how to query the lb_method for pool. Remember to use the SOAPMappingRegistry implementation we distribute in the shared directory to make sure that the namespaces are correctly matched to the serializer types.

     

     

    private iControlSOAPMappingRegistry smr = new iControlSOAPMappingRegistry(); 
     . 
     . 
     . 
     call.setSOAPMappingRegistry(smr);

     

     

    If you are still having problems, pass along your code (or a snippet of it) and I'll see if I can see what the problem is.

     

     

    -Joe