VMWare WSDL Client?

Greetings,

I'm just getting my feet wet with Ruby and have decided that it's the perfect tool for a couple of projects I have on the go. One component of a project is to be able to query (and eventually manipulate) information being offered from a VMWare Virtual Center server. They have a complete SDK available that's supported on Java, .Net and Axis. No mention of Ruby, but as long as it's a properly done WSDL implementation that shouldn't matter, right :slight_smile: ?

Anyway, I just downloaded the SDK and installed soap4r. When I try to run wsdl2ruby.rb, I get the following errors.

wsdl2ruby.rb --wsdl vim.wsdl --type client --force
F, [2007-02-16T17:01:57.716826 #806] FATAL -- app: Detected an exception. Stopping ... undefined method `new' for nil:NilClass (NoMethodError)
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/xsd/xmlparser/parser.rb:33:in `create_parser'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/xsd/xmlparser.rb:17:in `create_parser'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/parser.rb:53:in `initialize'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/importer.rb:29:in `new'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/importer.rb:29:in `parse'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/xmlSchema/importer.rb:30:in `import'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/importer.rb:18:in `import'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/soap/wsdl2ruby.rb:190:in `import'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/lib/wsdl/soap/wsdl2ruby.rb:34:in `run'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/bin/wsdl2ruby.rb:44:in `run'
/usr/lib/ruby/1.8/logger.rb:684:in `start'
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20061022/bin/wsdl2ruby.rb:131
/usr/bin/wsdl2ruby.rb:16:in `load'
/usr/bin/wsdl2ruby.rb:16
I, [2007-02-16T17:01:57.717081 #806] INFO -- app: End of app. (status: -1)

I can supply the vim.wdsl file that is in the SDK or it's available on the VMWare site.

Hints and tips appreciated,

Erik

I haven't tried the VIM WSDL with Ruby, but I can tell you that unless
you're very familiar with the API, I wouldn't recommend trying it as
an early project in Ruby. (I'm using gSOAP for C++ access to the API;
I'm succeeding, but the API makes LDAP look sane.)

-austin

路路路

On 2/16/07, Erik Ableson <eableson@mac.com> wrote:

Anyway, I just downloaded the SDK and installed soap4r. When I try
to run wsdl2ruby.rb, I get the following errors.

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽* austin@halostatue.ca * http://www.halostatue.ca/feed/
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽* austin@zieglers.ca

Hmmm - I've got lots of experience with LDAP :slight_smile: But thanks for the pointer - should you ever decide to give it a shot with Ruby, I'd be very interested in hearing how it goes... Out of curiosity, do you think it would be possible to edit vim.wsdl file to limit it to certain basic inventory functions?

Cheers,

Erik

路路路

On Feb 16, 2007, at 5:34 PM, Austin Ziegler wrote:

On 2/16/07, Erik Ableson <eableson@mac.com> wrote:

Anyway, I just downloaded the SDK and installed soap4r. When I try
to run wsdl2ruby.rb, I get the following errors.

I haven't tried the VIM WSDL with Ruby, but I can tell you that unless
you're very familiar with the API, I wouldn't recommend trying it as
an early project in Ruby. (I'm using gSOAP for C++ access to the API;
I'm succeeding, but the API makes LDAP look sane.)

The vast majority of the WSDL (it's pretty large at 900k) is the data
structure declarations, not the method calls. It's also polymorphic
depending on xsd:anyType; I don't know how well SOAP4R handles that (I
haven't tried, yet).

So no, editing it won't help.

-austin

路路路

On 2/16/07, Erik Ableson <eableson@mac.com> wrote:

Hmmm - I've got lots of experience with LDAP :slight_smile: But thanks for the
pointer - should you ever decide to give it a shot with Ruby, I'd be
very interested in hearing how it goes... Out of curiosity, do you
think it would be possible to edit vim.wsdl file to limit it to
certain basic inventory functions?

--
Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽* austin@halostatue.ca * http://www.halostatue.ca/feed/
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽* austin@zieglers.ca

Hi,

Sorry for the late response.

Austin Ziegler wrote:

Hmmm - I've got lots of experience with LDAP :slight_smile: But thanks for the
pointer - should you ever decide to give it a shot with Ruby, I'd be
very interested in hearing how it goes... Out of curiosity, do you
think it would be possible to edit vim.wsdl file to limit it to
certain basic inventory functions?

The vast majority of the WSDL (it's pretty large at 900k) is the data
structure declarations, not the method calls. It's also polymorphic
depending on xsd:anyType; I don't know how well SOAP4R handles that (I
haven't tried, yet).

So no, editing it won't help.

soap4r-1.5.6 might be able to handle that. At least wsdl2ruby.rb can
parse the definition...

0% time wsdl2ruby.rb --wsdl ../vimService.wsdl --type client
I, [2007-06-06T23:16:44.122325 #7343] INFO -- app: Creating class definition.
I, [2007-06-06T23:16:44.123911 #7343] INFO -- app: Creates file 'default.rb'.
I, [2007-06-06T23:16:48.348865 #7343] INFO -- app: Creating mapping registry definition.
I, [2007-06-06T23:16:48.350345 #7343] INFO -- app: Creates file 'defaultMappingRegistry.rb'.
I, [2007-06-06T23:16:56.941461 #7343] INFO -- app: Creating driver.
I, [2007-06-06T23:16:56.942492 #7343] INFO -- app: Creates file 'defaultDriver.rb'.
I, [2007-06-06T23:16:58.957728 #7343] INFO -- app: Creating client skelton.
I, [2007-06-06T23:16:58.958699 #7343] INFO -- app: Creates file 'VimServiceClient.rb'.
I, [2007-06-06T23:17:00.725305 #7343] INFO -- app: End of app. (status: 0)
wsdl2ruby.rb --wsdl ../vimService.wsdl --type client 12.89s user 3.97s system 82% cpu 20.335 total
0% ls -l
total 2368
-rw-rw-r-- 1 nahi nahi 112947 Jun 6 23:17 VimServiceClient.rb
-rw-rw-r-- 1 nahi nahi 760335 Jun 6 23:16 default.rb
-rw-rw-r-- 1 nahi nahi 180123 Jun 6 23:16 defaultDriver.rb
-rw-rw-r-- 1 nahi nahi 1323481 Jun 6 23:16 defaultMappingRegistry.rb
0% ruby -rdefaultDriver -e 'VimPortType.new.retrieveServiceContent(RetrieveServiceContent.new(ManagedObjectReference.new("Serviceinstance")))'
/usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:1523:in `initialize': Connection refused - connect(2) (localhost, #443) (Errno::ECONNREFUSED)
聽聽聽聽聽聽聽聽from /usr/local/lib/ruby/site_ruby/1.8/http-access2.rb:1523:in `new'

[snip]

I've not yet call the method actually (see above; connection refused),
it may work. Can someone try it?

Regards,
// NaHi