Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

SDK Managed Object Browser (568529)

Details

How do you invoke an operation in the Managed Object Browser?

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.

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



  2. Click the link for the operation you want to invoke.
    A window appears, in which you can enter the parameters.



  3. Enter the parameter's value in the Value field.
    See the section below about entering parameter values.

  4. 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>
 
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>
 
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"
                maxOccurs="unbounded"/>
        </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>
     <type>VirtualMachine</type>
     <all>false</all>
     <pathSet>config.guestFullName</pathSet>
   </propSet>
  <objectSet>
     <obj type="Folder">group-v3</obj>
   </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>
     <type>VirtualMachine</type>
     <all>false</all>
     <pathSet>config.guestFullName</pathSet>
     <pathSet>config.guestId</pathSet>
   </propSet>
  <objectSet>
     <obj type="Folder">group-v3</obj>
   </objectSet>
</spec>
 
Notice the multiple <pathSet> tags. Multiple <propSet> tags can be represented as follows:
 
<spec>
   <propSet>
     <type>VirtualMachine</type>
     <all>false</all>
     <pathSet>config.guestFullName</pathSet>
     <pathSet>config.guestId</pathSet>
   </propSet>
  <propSet>
     <type>HostSystem</type>
     <all>false</all>
     <pathSet>runtime.connectionState</pathSet>
  </propSet>
  <objectSet>
     <obj type="Folder">group-v3</obj>
   </objectSet>
</spec>
 

Keywords

SDK Managed Object Browser,Primitive arguments,invoking,568529 operations, arrays, complex types, 568529

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 2 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 2 Ratings
Actions
KB: