Support > Knowledge Base
Knowledge Base

Search the Knowledge Base: |
Search the Knowledge Base: |
SDK Managed Object Browser
Details
Solution
Note: Remember that you are connected to a server when you use the Managed Object Browser. Therefore, when you invoke operations, you are potentially making changes to the objects on the server. For example, if you invoke DeleteVm() on a virtual machine, you are deleting that virtual machine.
- After you access the Managed Object Browser, find the managed object that contains the operation you want to invoke.
Refer to the VMware Infrastructure SDK Programming Guide for information about accessing and navigating the Managed Object Browser.
After the list of properties, you see a list of the operations for this managed object, as shown in the following figure.
- Click the link for the operation you want to invoke.
A window appears, in which you can enter the parameters.
- Enter the parameter's value in the Value field.
See the section below about entering parameter values. - Click Invoke Method.
Entering Parameter
Values
For primitive arguments (int, string, boolean, and so on), for
which the input field is a single text field (for example,
partialUpdates in the figure above), enter the value as you see the
value in text form. For example, in the partialUpdates field above,
enter true or false.
For complex types (structured data), enter the value according
to the schema definition from WSDL. In the VMware
Infrastructure SDK Reference Guide, each page describing an
object contains a Show WSDL type definition link.
Clicking this link displays the definition and enables you to
construct the parameter value.
For example, the CloneVM_Task operation requires a Folder
managed object reference. If you click the Show WSDL type
definition link for ManagedObjectReference in the
reference guide, the following information appears:
<complexType
xmlns="http://www.w3.org/2001/XMLSchema"
name="ManagedObjectReference">
<simpleContent>
<extension base="xsd:string">
<attribute name="type" type="xsd:string"/>
</extension>
</simpleContent>
</complexType>
<simpleContent>
<extension base="xsd:string">
<attribute name="type" type="xsd:string"/>
</extension>
</simpleContent>
</complexType>
This information tells you that you should enter the
parameter value in the field as follows:
<folder
type="Folder">folder-123</folder>
In this example, folder is the name of the
parameter, type is
the type of managed object, and folder-123 is the managed
object ID. You can find the managed object ID in the Managed Object
Browser at the top of the page that describes the managed
object.
Some complex types have nested complex types. For example,
CreateFilter() has a spec parameter which is a PropertyFilterSpec.
Once you find PropertyFilterSpec in the reference guide and click
the Show WSDL type definition link, you see the
following:
<complexType
xmlns="http://www.w3.org/2001/XMLSchema"
name="PropertyFilterSpec">
<complexContent>
<extension base="vim2:DynamicData">
<sequence>
<element name="propSet" type="vim2:PropertySpec" maxOccurs="unbounded"/>
<element name="objectSet" type="vim2:ObjectSpec" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexContent>
<extension base="vim2:DynamicData">
<sequence>
<element name="propSet" type="vim2:PropertySpec" maxOccurs="unbounded"/>
<element name="objectSet" type="vim2:ObjectSpec" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
This information tells you that the PropertyFilterSpec has two
properties, propSet and objectSet, each of which is a complex type.
Find the PropertySpec in the reference guide and you see the
following WSDL definition:
<complexType
xmlns="http://www.w3.org/2001/XMLSchema"
name="PropertySpec">
<complexContent>
<extension base="vim2:DynamicData">
<sequence>
<element name="type" type="xsd:string"/>
<element name="all" type="xsd:boolean" minOccurs="0"/>
<element name="pathSet" type="xsd:string" minOccurs="0"
<complexContent>
<extension base="vim2:DynamicData">
<sequence>
<element name="type" type="xsd:string"/>
<element name="all" type="xsd:boolean" minOccurs="0"/>
<element name="pathSet" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
</sequence>
</extension>
</complexContent>
</complexType>
With these as your guide (and by checking the WSDL definition
of the ObjectSpec), the value in the parameter field might look
something like:
<spec>
<propSet>
<propSet>
<type>VirtualMachine</type>
<all>false</all>
<all>false</all>
<pathSet>config.guestFullName</pathSet>
</propSet>
</propSet>
<objectSet>
<obj type="Folder">group-v3</obj>
</objectSet>
</objectSet>
</spec>
In this example, spec represents the
parameter name, propSet and objectSet represent the two
properties of the PropertyFilterSpec, and the tags within each of
those represent their properties. Notice the order of the
properties. The properties must follow the order of the
properties in the WSDL definition. Also notice <obj type="Folder">.
This is a managed object, so the tag includes a type attribute and
the value is a managed object ID.
An array is represented by multiple, sequential tags. For
example:
<spec>
<propSet>
<propSet>
<type>VirtualMachine</type>
<all>false</all>
<all>false</all>
<pathSet>config.guestFullName</pathSet>
<pathSet>config.guestId</pathSet>
</propSet>
</propSet>
<objectSet>
<obj type="Folder">group-v3</obj>
</objectSet>
</objectSet>
</spec>
Notice the multiple <pathSet>
tags. Multiple <propSet>
tags can be represented as follows:
<spec>
<propSet>
<propSet>
<type>VirtualMachine</type>
<all>false</all>
<all>false</all>
<pathSet>config.guestFullName</pathSet>
<pathSet>config.guestId</pathSet>
</propSet>
</propSet>
<propSet>
<type>HostSystem</type>
<all>false</all>
<all>false</all>
<pathSet>runtime.connectionState</pathSet>
</propSet>
<objectSet>
<obj type="Folder">group-v3</obj>
</objectSet>
</objectSet>
</spec>
Keywords
Feedback
Actions
- KB Article: 568529
- Updated: Aug 14, 2009
- Products:
VMware ESX
VMware VirtualCenter - Product Versions:
VMware ESX 3.0.x
VMware VirtualCenter 2.0.x

