This article presents an alternative approach to the document Tech Tip: Using the SOAP Control API with Ruby.
An alternative method for using Riverbed's Control api with Ruby is to use the soap4r SOAP implementation. This may be found at http://dev.ctor.org/soap4r.
Note: At the time of writing the use of soap4r depends on the 'httpclient' Ruby library, formerly known as 'http-access2'.
The first thing you have to do is obtain the published specification for Stingray's API. You can download this from the product's admin interface, Diagnose > Technical Support, clicking "Control API WSDL Files". Extract this zip file to get the WSDL files we are looking for.
Soap4r comes with a tool 'wsdl2ruby.rb' which will take our WSDL files and produce Ruby files which we can import into our scripts. T he invocation you will use will look something like this:
$ wsdl2ruby.rb --wsdl VirtualServer.wsdl --type client
... to create the following files:
Once this is done you can include these in the programs or scripts you write. The important difference here, from our previous Ruby example, is that we no longer have to define every function that we intend to use and the arguments it expects.
Here is the analogous listing enabled virtual servers example using soap4r:
endpoint = "https://zxtm:9090/soap"
username = "admin"
pass = "somepass"
driver = VirtualServerPort.new(endpoint)
driver.options["protocol.http.ssl_config.verify_mode"] = OpenSSL:SL::VERIFY_NONE
driver.options["protocol.http.basic_auth"] << [endpoint,username,pass]
vslist = driver.getVirtualServerNames
enabled = driver.getEnabled(vslist)
vslist.length.times do |i|