Forum Discussion

Bryce_Klimoski's avatar
Bryce_Klimoski
Icon for Nimbostratus rankNimbostratus
Oct 08, 2009

Help with query_rule in java

I'm having trouble getting query_rule to work with java.

 

 

Here is my code.

 

      iControl.GlobalLBRuleBindingStub iRuleQuery = (iControl.GlobalLBRuleBindingStub) new iControl.GlobalLBRuleLocator().getGlobalLBRulePort(new java.net.URL(url)); 
       iRuleQuery.setTimeout(60000); 
  
       GlobalLBRuleRuleDefinition[] rule = iRuleQuery.query_rule(new String[] {"foobar"});

 

 

It always returns with the GTM not being able to find the iRule, even though it exists and I can use query_rule in perl just fine.

3 Replies

  • What exactly is the error? I just ran the code and it returned what was expected

     

     public void getGtmRule(String rulename) throws Exception   
     {   
       iControl.GlobalLBRuleRuleDefinition [] rule_defs = m_interfaces.getGlobalLBRule().query_rule(new String[] { rulename });   
       for(int i=0; i   {   
         System.out.println(rule_defs[ i ].getRule_name());   
         System.out.println(rule_defs[ i ].getRule_definition());   
         System.out.println("-----------------------");   
       }   
     }

     

    Are you using the iControl library for Java or are you compiling the WSDL yourself?

     

    -Joe
  • I am using the WSDLs. I figure out what I had wrong, needed to be making the call to local and not global.

     
           iControl.LocalLBRuleBindingStub iRuleQuery = (iControl.LocalLBRuleBindingStub) new iControl.LocalLBRuleLocator().getLocalLBRulePort(new java.net.URL(url));  
            iRuleQuery.setTimeout(60000);  
      
            LocalLBRuleRuleDefinition[] rule = iRuleQuery.query_rule(new String[] {"foobar"}); 
     
  • That would do it...

     

     

    Is there a reason why you aren't using the iControl.jar library for Java? I've all the WSDL's along with a wrapper/accessor class that makes it a snap to use. If there's a reason why it doesn't work for you, I'd love to make mods to it to accommodate your project.

     

     

    BTW, if you are looking for it, you can find it on the iControl Assembly labs project.

     

     

    -Joe