VMWare WSDL Client?


#1

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:increate_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:ininitialize’
/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:inparse’
/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:inimport’
/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:inrun’
/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:instart’
/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


#2

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

On 2/16/07, Erik A. removed_email_address@domain.invalid 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.)

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


#3

On 2/16/07, Erik A. removed_email_address@domain.invalid 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.)

-austin


#4

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for the late response.

Austin Z. wrote:

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…

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:innew’
[snip]

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

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRmbDXx9L2jg5EEGlAQLfNQf+PjuILyFvBtwKitfl/Z7P66yyZ/vNu4yV
4nTLoiArIfpjmO611Dxhx1gYP+tYt9KokmFujc+9g4kH2abEH12q/qrwbvGUHuiw
/7v7wY1Rcp/gJjKwrxvR0VoBi1dbYychPLlpbvX1Y0NTwnGbMiyOghKq/ODgSPC8
3PNCXK8mOvAdSBxhLXtaLBQwbAWj0zt3KDvmyKPHdJjtB7/kt2C8hj0gHSxZdzgp
DtEKJCFNH9DbTqBt5Ja+fobl+kQ8S/lVgAxmwUR5qq/JnBOflZAONZrU3QukRZFK
RB1ehSizgSTFQQKtVHNtJ1Qq7ozqWijlo8fhYcQ8TkP5IHOQmXRjMw==
=n0x+
-----END PGP SIGNATURE-----


#5

On 2/16/07, Erik A. removed_email_address@domain.invalid 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.

-austin