4.1

Table Of Contents
Find Objects in the Orchestrator Server
To perform any useful task with a workflow, you must find the objects on which the workflow will run. The
Orchestrator Web service API provides functions for finding objects of all types in the VMware Infrastructure
inventory.
Workflows typically run on objects in the vCenter Server. Workflows can also run on objects from outside the
vCenter Server by accessing them through plug-ins.
The operations that the Web service API defines for finding objects are as follows.
n
find
n
findForId
n
findRelation
n
hasChildrenInRelation
All of the operations that find objects return FinderResult objects, either individually, as an array, or embedded
in a QueryResult object.
Find Objects by Using the find Operation
You can use the find operation to find objects of any type that match a particular search criterion, that you set
in the query parameter.
The vso.xml file of the plug-in through which you access the object defines the syntax of the query parameter.
Prerequisites
You must have created a connection to the Orchestrator Web services endpoint in your Web service client
application class.
Procedure
1 Create a QueryResult object by calling the find operation on an object.
The following code example shows how an application can call the find operation to find out how many
virtual machines are accessible by a particular user through the vCenter Server plug-in.
QueryResult queryResult = vsoWebControl.find("VC:VirtualMachine", null,
<username>
,
<password>
);
if (queryResult != null) {
System.out.println("Found " + queryResult.getTotalCount() +
" objs.");
FinderResult[] elts = queryResult.getElements();
finderResult = elts[0];
displayFinderResult(finderResult);
}
else {
System.out.println("Found nothing");
}
According to the query syntax defined by the vCenter Server plug-in, setting the query parameter to
null returns the list of all of the objects of the type specified by the first parameter. The preceding code
example performs the following tasks.
n
Gets the list of any VC:VirtualMachine objects in the library.
n
Calls the QueryResult object's getTotalCount operation to obtain the total number of
VC:VirtualMachine objects found and print the value.
vCenter Orchestrator Developer's Guide
248 VMware, Inc.