SOAP – SAVON v2 Syntax

 

So for the past few years Savon v1.1.0 has been the default GEM in the appliance. Heres a scoop! In future releases, and the upstream builds have Savon v2.

What does this mean? Well v2 has a slightly different syntax to its connections and function call. Here is a v2 SOAP example:

require 'savon'

client = Savon.client do | globals |
globals.wsdl "https://x.x.x.x/vmdbws/wsdl"
globals.basic_auth ["admin", "smartvm"]
globals.ssl_verify_mode :none
globals.ssl_version :TLSv1
end

body_hash = {}
body_hash['version'] = '1.1'
body_hash['uri_parts'] = "namespace=Sample|class=Methods|instance=InspectMe|message=create"
body_hash['parameters'] = ""
body_hash['requester'] = "auto_approve=true"

response = client.call(:create_automation_request, message: body_hash)

Notice that the client call is different, and also the document is now just wsdl.

Another option for you if you wish to work with older v1.1.0 syntax scripts, then simply add to the top of your scripts;

require 'rubygems'
gem 'savon', '= 1.1.0'
require 'savon'

This will allow you to use your script as is, but forcing it to use the v1.1.0 Savon GEM. I have documented this route in the thinking that you are running your script REMOTE to the appliance. This is not a proposed route for modifying existing scripts running in an appliance.

Really the advice I give here is that;

  • If you are running your scripts REMOTE to the appliance then either upgrade your syntax to v2 or force the scripts to use v1 Savon gem.
  • If your script is running LOCAL to the appliance, change your syntax to v2.
  • If you are writing a NEW script, use the v2 syntax (and specify the version in your script like a happy scripter would do!)

Hope this helps.

Savon web site is http://savonrb.com/version2/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s