[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

VMWare WSDL Client?

Erik Ableson

2/16/2007 4:26:00 PM

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 :-) ?

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

3 Answers

Austin Ziegler

2/16/2007 4:34:00 PM

0

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.)

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

Austin Ziegler

2/16/2007 7:58:00 PM

0

On 2/16/07, Erik Ableson <eableson@mac.com> wrote:
> Hmmm - I've got lots of experience with LDAP :-) 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
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

NAKAMURA, Hiroshi

6/6/2007 2:24:00 PM

0

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

Hi,

Sorry for the late response.

Austin Ziegler wrote:
>> Hmmm - I've got lots of experience with LDAP :-) 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

-----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-----