VMware {code} Community
DanDaugherty
Contributor
Contributor
Jump to solution

ManagedObjectReference subclasses missing in C# generated code

I see tons of references to VirtualMachine, HostSystem, DataCenter classes (among many others) in the API Reference but they were never generated in the proxy code.  I checked the wsdl's and xsd's for vim and vim25 and found no reference to those classes.  I also checked the Java samples and there is no reference to them in there either.

I'm trying a simple example call to FindByIp to get a VirtualMachine object back.  I turned on System.Net debugging to see if the SOAP response was sending back more information than just the type and Value in the ManagedObjectReference class and it's not.

Any ideas as to why these classes are missing from the API even though they are referenced throughout the API refrence docs?

THanks,
Dan

Reply
0 Kudos
1 Solution

Accepted Solutions
stumpr
Virtuoso
Virtuoso
Jump to solution

You'll want to use RetrievePropertiesEx.  There's a whole section of the developer guide on how to build TraversalSpecs for property retrieval.  It's a bit complex, but it does give a lot of micro-management of what objects and properties you want from the inventory.

Reuben Stump | http://www.virtuin.com | @ReubenStump

View solution in original post

Reply
0 Kudos
5 Replies
stumpr
Virtuoso
Virtuoso
Jump to solution

They're technically ManagedEntity IIRC.  However, I don't think they have ever been in the WSDL/SDK specifications.  I think developers create their own subclasses of ManagedEntity and attach relevant functions. 

When you look at the SOAP, the _this parameter could be any ManagedEntity.  The SDK interface will throw back an exception when you try to call an operation on an unsupported Entity type.

The SDK toolkits each create the subclasses for the ManagedEntity types and associates the operations with them appropriately.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
DanDaugherty
Contributor
Contributor
Jump to solution

stumpr wrote:

They're technically ManagedEntity IIRC.  However, I don't think they have ever been in the WSDL/SDK specifications.  I think developers create their own subclasses of ManagedEntity and attach relevant functions. 

When you look at the SOAP, the _this parameter could be any ManagedEntity.  The SDK interface will throw back an exception when you try to call an operation on an unsupported Entity type.

The SDK toolkits each create the subclasses for the ManagedEntity types and associates the operations with them appropriately.

Are you saying there is an additional toolkit out there that has these classes or that I need to make them myself without any expectation of the api actually filling in the data I want?  I don't understand why they reference classes in their documentation that don't actually exist.

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

They exist, just not as class constructs in the default WSDL.  I'm not sure why its like that to be honest.  When you get your ManagedEntity reference, you can discover its type through the type property.  The allowed properties and methods are what is described in the SDK documentation, however, you can try an unsupported method or request an unsupported property.  The SDK will throw back a SOAP fault indicating the error.

I'm not sure about the C# SDK, the scripting toolkits create a local version of the managed entity subclasses for convienance. 

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
DanDaugherty
Contributor
Contributor
Jump to solution

So let us use a concrete example.  I want to get the properties of a vm whose IP address I know.

I call FindByIp(...) and get back a ManagedObjectReference(type=VirtualMachine, Value=vm-123).  I can already do this.

Now if I want to get any information, say a populated VirtualMachineConfigInfo, how do I do that?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

You'll want to use RetrievePropertiesEx.  There's a whole section of the developer guide on how to build TraversalSpecs for property retrieval.  It's a bit complex, but it does give a lot of micro-management of what objects and properties you want from the inventory.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos