VMware vSphere Web Services SDK Java Samples Reference Documentation


com.vmware.apputils Helper classes used by all VMware vSphere Web Services SDK Java sample applications.
com.vmware.samples.alarms Samples that demonstrate setting alarms on a virtual machine for power operations.
com.vmware.samples.ciminfo Samples that demonstrate obtaining information from CIM providers on server.
com.vmware.samples.events Samples that demonstrate working with Events and EventManager, including how to format event messages.
com.vmware.samples.general Several sample applications that demonstrate a variety of inventory operations, such as connecting to the server (Connect), browsing the inventory (Browse), and moving an entity from one location in the inventory to another (Move).
com.vmware.samples.host Demonstrates working with virtual NICs, virtual switches, and virtual port groups.
com.vmware.samples.httpfileaccess Demonstrates how to use the HTTP protocol to move virtual machine files over the network.
com.vmware.samples.performance Samples that demonstrate how to obtain performance data from the PerformanceManager.
com.vmware.samples.scheduling Samples that demonstrate how to use the ScheduledTaskManager.
com.vmware.samples.scsilun Samples that demonstrate how to obtain canonical LUN information.
com.vmware.samples.simpleagent Samples that demonstrate using the local credential store to automate login to a VMware vSphere server.
com.vmware.samples.version Samples that demonstrate how to target multiple servers that support different versions of the API.
com.vmware.samples.vm Samples that demonstrate various virtual machine operations, including cloning, creating virtual machines, power-cycling, reconfiguring, and snapshot.
com.vmware.security.credstore Credential store implementation for storing and retrieving user account and password in a local file.



This Javadoc generated documentation set provides information about the sample applications included with the VMware vSphere Web Services SDK package. The samples include:

Documentation for all of these is included. This page contains:

Running the Samples

All the samples use classes from the apputils package to authenticate the user running the application and create a connection to the server. Minimally, each application requires:


java com.vmware.samples.packagename.SampleClassName --url https://myserver --userName username --password password --ignorecert

Here’s the complete list of built-in command-line parameters (options) provided by the apputils classes:

Parameter Description Example
--urlRequired. Complete URL for the vSphere API Web service for the connection.--url https://www.myserver.com/sdk
--userNameRequired. User account with privileges to connect to the host. --userName root
--passwordRequired. Password for the user account.--password mypassword
--config Location of an optional configuration file that contains the required parameters.--config c:\myfilename
--protocolProtocol for the server connection (HTTP, HTTPS; HTTPS is the default).--protocol http
--serverFully-qualified name of the server to connect to, such as myserver.mycompany.com.--server myserver.mycompany.com
--portNumberServer port for the vSphere API Web service. Default is 443 (for HTTPS).--portNumber 8080
--servicePathService path for the vSphere API, such as /sdk, /sdk/webService--servicePath sdk
--sessionFileFile containing a previously saved session cookie, for re-establishing connection to the server.--sessionFile c:\mysessionfile
--helpDisplay usage information for the application or script.--help
--ignorecertAvoid the SSL server-certificate validation process. Using the --ignorecert option lets you by-pass importing server-certificates and creating a vmware.keystore (using the Java keytool utility). --ignorecert