First you need to install a new gem called savon to enable ruby as a SOAP client. After that the require 'savon' loads the gem.
Now here is an example to get some vCenter Orchestrator workflows:
require 'savon'
Savon.configure do |config|
config.log = false
end
client = Savon::Client.new do
wsdl.document = "http://10.4.13.15:8280/vmware-vmo-webcontrol/webservice?wsdl"
end
user = "YourUser"
pass = "YourPass"
def findWorkflow(wfName, client,user,pass)
response = client.request :get_workflows_with_name do
soap.body = { workflowName: wfName, username: user, password: pass }
end
return response
end
def getAllWfs(client,user,pass)
response = client.request :get_all_workflows do
soap.body = { username: user, password: pass}
end
return response
end
def getAllWfInfos(allWfs)
allWfs[:get_all_workflows_response][:get_all_workflows_return].each do |wf|
wf.each { |x| x.each { |y| p y } }
end
end
myWfs = getAllWfs(client)
wfInfos = getAllWfInfos(myWfs)
This code produces the following output:
So maybe this helps you to play around with ruby and some SOAP operations. Hopefully I will find some time to consume the REST API of the vCloud Director and show you some examples :)