Forum Discussion

Jos_Backus_4637's avatar
Jos_Backus_4637
Icon for Nimbostratus rankNimbostratus
Jun 01, 2009

Small Ruby code example

http://www.catnook.com/programs/f5-icontrol/ contains a small SOAP4R wrapper plus an application which shows how to list the nodes in a pool. The wrapper library expects to be able to access the WSDL data. Feedback welcome. Enjoy!

 

 

Jos

15 Replies

  • Fyi: I renamed node-monitor-state to node-state as it now changes both the monitor and session_enabled states.

     

     

    Jos
  • Hey, josb. A user posted to the blog comments that the link is not working any longer. Is there a new location for the wrapper files?
  • The site should be working again. There was a nasty bug in the library that prevented the use of multiple loadbalancers in the same program. This bug has been fixed. Feedback welcome.

     

     

    Jos
  • Code question:

     

     

    I've taken a look at your library but was unable to get it working. It looks like this API verifies on a per session basis and not a per request basis. I've not dealt with a SOAP API that does verification in this matter and was wondering if anyone had a suggestion or could point me to what I've missed. The exception is:

     

     

     

    Errno::ECONNREFUSED: Connection refused - connect(2) (://:0)

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:675:in `initialize'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:675:in `new'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:675:in `create_socket'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:632:in `connect'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/timeout.rb:128:in `timeout'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:631:in `connect'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:522:in `query'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient/session.rb:147:in `query'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:942:in `do_get_block'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:758:in `do_request'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:837:in `protect_keep_alive_disconnected'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:757:in `do_request'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:822:in `follow_redirect'

     

    from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.4/lib/httpclient.rb:514:in `get_content'

     

    from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:64:in `fetch'

     

    from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in `import'

     

    from /usr/lib/ruby/1.8/wsdl/importer.rb:18:in `import'

     

    from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import'

     

    from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize'

     

    from /home/clundquist/trunk/lib/f5.rb:74:in `new'

     

    from /home/clundquist/trunk/lib/f5.rb:74:in `initialize'

     

    from /home/clundquist/trunk/lib/f5.rb:55:in `new'

     

    from /home/clundquist/trunk/lib/f5.rb:55:in `initialize'

     

    from /home/clundquist/trunk/lib/f5.rb:67:in `call'

     

    from /home/clundquist/trunk/lib/f5.rb:67:in `default'

     

    from /home/clundquist/trunk/lib/f5.rb:67:in `[]'

     

    from /home/clundquist/trunk/lib/f5.rb:67:in `method_missing'

     

    from /home/clundquist/trunk/lib/f5.rb:290:in `nodes'

     

     

    The code of interest is:

     

    73 @name = name

     

    74 @driver = SOAP::WSDLDriverFactory.new(wsdl_name).create_rpc_driver

     

    75

     

    76 verify_mode = OpenSSL::SSL::VERIFY_NONE

     

    77 @driver.options['protocol.http.ssl_config.verify_mode'] = verify_mode

     

    78 @driver.options['protocol.http.ssl_config.verify_callback'] = lambda {|is_ok, ctx| true}

     

    79 @driver.options['protocol.http.basic_auth'] << mod.base.basic_auth

     

    80 if mod.base.connect_timeout

     

    81 @driver.options["protocol.http.connect_timeout"] = mod.base.connect_timeout

     

    82 end

     

     

     

    To me this looks like it is trying to access the WSDL to try to generate the methods before I have set the authentication credentials. The only thing that looks odd to me is that at the end of the exception it has (://:0). Does that mean it tried to connect to "://:0" and not "http://hostname/:port"? If so that is even more confusing because I have specified "method" and "endpoint" and if method is https it should be port 443

     

     

    I would appreciate any insight.

     

     

    Thanks,

     

    Chris Lundquist
    • Andy_Litzinger's avatar
      Andy_Litzinger
      Hi Chris- I know this is really old but just wanted to comment that I got the same error above when the module couldn't find the WSDL files. as soon as i moved them to the right place (in my case, the fixtures dir of my project), the error went away.