VMware vSphere Web Services SDK .NET (DotNet) Samples Readme

VMware logo

This document includes these topics:

Note:   Information in this document may not be current. For up-to-date information, check these VMware Web sites:
Beta or Pre-release Products VMware Beta Community
Released SDK ProductsVMware vSphere Web Services SDK

Requirements

.NET framework 4.5+, Visual Studio 2012+ and Windows Driver Kit (WDK)

Using the vSphere Web Services SDK .NET Samples

The vSphere Web Services SDK .NET samples use authenticated access to a vCenter Server. This includes support for SAML token login to vCenter Servers. To run the samples, you set up the development environment, build the dynamic link libraries, and build the samples.

  1. Setup the development work environment - Microsoft Visual programming environment, Microsoft .NET Framework, and Windows Driver Kit (WDK).
  2. Download and unzip the vSphere Web Services SDK package.
  3. Define environment variables for vSphere Web Services files (WS_SDK_HOME and WSDLHOME) and Visual Studio (VSINSTALLDIR) if you are not using the default Visual Studio setup.
  4. Build C# DLLs for access to the VMware Single Sign On Server.
  5. Build C# DLLs for access to vSphere servers.
  6. Build the C# sample programs.
  7. Run a sample application.

See the Developer’s Setup Guide (Chapter 3, “Setting Up for Microsoft C# Development”) for complete information.

Some Sample Applications

SampleDescription, command-line syntax, and example...
Browser Gets contents of the Service starting at the root folder, and prints out listing. Optionally, obtain properties for a specific type, or by default, for ManagedEntity.

Command line syntax:
Browser <webserviceurl> <username> <password> <ssoUrl> [<mo type> <property name> ...]

Examples:
Browser http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService
Browser http://myserver/sdk myuser mypaswd http://sso-server:port/ims/STSService VirtualMachine name

ConnectConnects to service, logs into service, and logs out of service.

Command line syntax:
Connect <webserviceurl> <username> <password> <ssoUrl>

Example:
Connect http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService

EventFormat

Retrieve and Format the latest event. Demonstrates Event formatting.

Command line syntax:
EventFormat <webserviceurl> <username> <password> <ssoUrl>

Example:
EventFormat http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService

SimpleClientCode that demonstrates connecting to service, logging on to service, obtaining service content, and logging out from service.

Command line syntax:
SimpleClient <webserviceurl> <username> <password> <ssoUrl>

Example:
SimpleClient http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService

VmPowerOps Retrieves a reference to a vm and invokes various power operations on it, as specified on the command line options.

Command line syntax:
VmPowerOps <webserviceurl> <username> <password> <ssoUrl> <vmname> <on|off|suspend|reset> <hostname>

Example:
VmPowerOps http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService myWin2k3_ProductionVM on myhost.mycompany.com

WatchVM

Monitors updates on a particular virtual machine using the PropertyCollector.

Command line syntax:
WatchVM <webserviceurl> <username> <password> <ssoUrl> <inventory-path-to-vm>

Example:
WatchVM http://my-server/sdk myuser mypaswd http://sso-server:port/ims/STSService Datacenter1/vm/myvm

VMware Resources


Copyright © 2012-2016 VMware, Inc. All rights not expressly granted herein are reserved.

Last updated: 15 Nov 2016 |  VMware vSphere Web Services SDK