VMware vSphere Web Services SDK 6.0 User guide

Category
System management software
Type
User guide
vSphere Web Services SDK
Programming Guide
vSphere Web Services SDK 6.0
This document supports the version of each product listed and
supports all subsequent versions until the document is replaced
by a new edition. To check for more recent editions of this
document, see http://www.vmware.com/support/pubs.
EN-001411-02
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2 VMware, Inc.
vSphere Web Services SDK Programming Guide
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com
Copyright © 2011-2015 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and
intellectual property laws. VMware products are covered by one or more patents listed at
http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.
VMware, Inc. 3
Contents
About This Book 11
1 VMware vSphere and vSphere Management APIs 13
Virtualization and VMware vSphere Components 13
vSphere Development Tools 14
vSphere Web Services SDK 14
CIM APIs 14
vSphere SDK for Perl 14
vSphere PowerCLI 14
VIX API 14
SDK Developer Setup 15
SDK Samples 15
UML Diagrams Used in This Guide 15
2 vSphere API Programming Model 17
vSphere Client-Server Architecture 17
vSphere API as a Web Service 18
WSDL Files and the Client-Side Proxy Interface 18
Network Access to the vSphere Web Service 19
Language-Specific Classes and Methods 19
Mapping XML Data Types to Java and C# Data Types 20
Access to Managed Objects 21
Access to vSphere Server Data 21
Obtaining Information from a Server 22
Working with Data Structures 22
Accessing Property Values 22
Unset Optional Properties 25
Escape Character in Name and Path Properties 25
3 Client Applications 27
vCenter Server Connections 27
Establishing a Single Sign On Session with a vCenter Server 28
LoginByToken (C# Example) 28
LoginByToken (Java Example) 33
Establishing a Session with Username and Password Credentials 38
Overview of a Java Sample Application 38
Web Server Session Token 41
Accessing the HTTP Endpoint with JAX-WS 42
Accessing the vSphere Server 43
Closing the Connection 44
Using the Java Samples as Reference 44
Multiple Versions of the vSphere API 45
Identifying the API Version Supported by the Server 46
Java and C# Sample Applications 46
Java Samples 46
C# Samples 46
vSphere Web Services SDK Programming Guide
4 VMware, Inc.
4 Datacenter Inventory 49
Inventory Overview 49
Inventory Hierarchies and ServiceInstance 50
Folders in the Hierarchy 50
ESXi Inventory Hierarchy 51
Accessing Inventory Objects 51
Creating Inventory Objects 52
Privileges Required for Inventory Management 52
Privileges 53
Permissions 53
Managed and Standalone ESX/ESXi Hosts 54
5 Property Collector 57
Introduction to the PropertyCollector 57
Data Retrieval 58
Inventory Traversal and Object Selection 58
vSphere Data Objects for Property Collection 58
vSphere Methods for Property Collection 58
PropertyCollector Example (RetrievePropertiesEx) 59
Inventory Traversal 66
TraversalSpec Traversal 66
SelectionSpec Traversal 72
Client Data Synchronization (WaitForUpdatesEx) 77
Property Filters 77
WaitForUpdatesEx 77
Server Data Transmission 79
PropertyCollector Performance 79
SearchIndex 79
6 Authentication and Authorization 81
Objects for Authentication and Authorization Management 81
Authentication and Authorization for ESXi and vCenter Server 82
ESXi User Model 82
vCenter Server User Model 83
vSphere Security Model 83
Setting Up Users, Groups, and Permissions 84
Obtaining User and Group Information from UserDirectory 85
Managing ESXi Users with HostLocalAccountManager 86
Managing Roles and Permissions with AuthorizationManager 86
Using Roles to Consolidate Sets of Privileges 88
Modifying Sample Roles to Create New Roles 89
Granting Privileges Through Permissions 89
Authenticating Users Through SessionManager 91
Using VMware Single Sign On for vCenter Server Sessions 91
Using the Credential Store for Automated Login 91
Credential Store Methods 92
Credential Store Backing File 92
Credential Store Samples 93
Specifying Roles and Users with the Credential Store 93
Managing Licenses with LicenseManager 94
7 Hosts 95
Host Management Objects 95
Retrieving Host Information 95
VMware, Inc. 5
Contents
Configuring and Reconfiguring Hosts 96
Managing the Host Lifecycle 97
Reboot and Shutdown 97
Using Standby Mode 97
Disconnecting and Reconnecting Hosts 97
Querying and Changing the Host Time 98
Querying Virtual Machine Memory Overhead 98
8 Storage 99
Storage Management Objects 99
Introduction to Storage 100
How Virtual Machines Access Storage 100
Datastores 101
Choosing the Storage API to Use 102
Configuring Disk Partitions 103
Multipath Management 104
Configuring iSCSI Storage 104
Creating and Managing Datastores 106
Accessing Datastores 107
Creating and Modifying a VMFS Datastore 107
Removing and Updating Datastores 109
Managing VMFS Datastores with HostStorageSystem 109
Managing VMFS Volume Copies (Resignaturing) 109
Managing Diagnostic Partitions 110
Retrieving Diagnostic Partition Information 111
Creating a Diagnostic Partition 111
Sample Code Reference 111
9 vSphere Networks 113
Virtual Switches 113
Using a Distributed Virtual Switch 114
Distributed Virtual Switch Configuration 115
Backup, Rollback, and Query Operations 116
VMware Standard Virtual Switch 116
vNetwork Standard Switch Environment 117
Setting Up Networking with vSS 118
Defining the Host Network Policies 120
NIC Teaming 120
Setting Up IPv6 Networking 121
Adding Networking Services 122
Sample Code Reference 122
10 Virtual Machine Configuration 125
VirtualMachine Management Objects and Methods 125
Creating Virtual Machines and Virtual Machine Templates 126
Creating a Virtual Machine Using VirtualMachineConfigSpec 126
Creating Virtual Machine Templates 127
Cloning a Virtual Machine 127
Converting a Template to a Virtual Machine 128
Accessing Information About a Virtual Machine 128
Configuring a Virtual Machine 129
Name and Location 130
Hardware Version 130
Boot Options 131
vSphere Web Services SDK Programming Guide
6 VMware, Inc.
Operating System 131
CPU and Memory Information 132
Networks 133
Fibre Channel NPIV Settings 133
File Locations 134
Adding Devices to Virtual Machines 134
Performing Virtual Machine Power Operations 135
Registering and Unregistering Virtual Machines 136
Customizing the Guest Operating System 137
Installing VMware Tools 137
Upgrading a Virtual Machine 138
11 Virtual Machine Management 139
Virtual Machine Migration 139
Cold Migration 140
Migration with VMotion 140
Using Storage VMotion 140
Snapshots 140
Creating a Snapshot 141
Reverting to a Snapshot 141
Deleting a Snapshot 142
Linked Virtual Machines 142
Linked Virtual Machines and Disk Backings 142
Creating a Linked Virtual Machine 143
Removing Snapshots and Deleting Linked Virtual Machines 144
Relocating a Virtual Machine in a Linked Virtual Machine Group 144
Promoting a Virtual Machine's Disk 145
Performing Advanced Manipulation of Delta Disks 145
12 Virtual Applications 147
About Virtual Applications 147
Management Overview 147
Direct and Linked Children 148
OVF Packages 148
Creating a VirtualApp 149
Managing VirtualApp Children 149
Exporting a Virtual Application 150
VirtualApp and OvfManager Methods 150
VirtualApp Data Structures 151
OvfManager Data Structures 152
Example of Generating an OVF Package 152
Importing an OVF Package 154
Virtual Application Life Cycle 154
Powering a Virtual Application On or Off 154
Unregistering a Virtual Application 155
Suspending a Virtual Application 155
Destroying a Virtual Application 155
13 Resource Management 157
Resource Management Objects 157
Introduction to Resource Management 158
Resource Allocation 158
Resource Pool Hierarchies 158
Resource Pool Management Guidelines 159
VMware, Inc. 7
Contents
Cluster Overview 159
Creating and Configuring Resource Pools 160
Understanding Expandable Reservation 160
Deleting Child Resource Pools 161
Moving Resource Pools or Virtual Machines Into a Resource Pool 162
Introduction to VMware DRS and VMware HA Clusters 162
VMware DRS 162
VMware HA 162
Creating and Configuring Clusters 163
Creating a Cluster 163
Adding a Host to a Cluster 164
Reconfiguring a Cluster 164
Managing DRS Clusters 164
Managing HA Clusters 165
Using VMware HA and DRS Together 166
14 Tasks and Scheduled Tasks 167
Creating Tasks 167
Session Persistence 167
Cancelling a Task 168
Using TaskInfo to Determine Task Status 168
Monitoring TaskInfo Properties 169
Accessing and Manipulating Multiple Tasks 170
Gathering Data with a ViewManager Object 170
Gathering Data with a TaskManager Interface 177
Understanding the ScheduledTaskManager Interface 179
Scheduling Tasks 180
Cancelling a Scheduled Task 182
Using a TaskHistoryCollector 183
Creating a TaskHistoryCollector Filter 183
Managing the HistoryCollector 183
Sample Code Reference 184
15 Events and Alarms 185
Event and Alarm Management Objects 185
Understanding Events 185
Managing Events with EventManager 186
Event Data Objects 187
Formatting Event Message Content 187
Creating Custom Events 188
Using an EventHistoryCollector 188
Creating an EventHistoryCollector Filter 188
Managing the HistoryCollector 189
Using Alarms 189
Obtaining a List of Alarms 189
Creating an Alarm 190
Defining Alarms Using the AlarmSpec Data Object 190
Specifying Alarm Trigger Conditions with AlarmExpression 191
Specifying Alarm Actions 192
Deleting or Disabling an Alarm 193
Sample Code Reference 193
16 vSphere Performance 195
vSphere Performance Data Collection 195
vSphere Web Services SDK Programming Guide
8 VMware, Inc.
PerformanceManager Objects and Methods 197
Retrieving vSphere Performance Data 198
Performance Counter Example (QueryPerf) 199
Large-Scale Performance Data Retrieval 206
Using the QueryPerf Method as a Raw Data Feed 206
Comparison of Query Methods 207
Retrieving Summary Performance Data 207
Performance Counter Metadata 208
Performance Intervals 208
vSphere Performance and Data Storage 210
Modifying Historical Intervals 210
Modifying Performance Counter Collection Levels 210
Sample Code Reference 211
A Diagnostics and Troubleshooting 213
Troubleshooting Best Practices 213
Overview of Configuration Files and Log Files 214
ESX/ESXi Log File 214
Virtual Machine Log Files 215
vCenter Server Log Files 216
Modifying the Log Level to Obtain Detailed Information 216
Setting the Log Level on ESX/ESXi Systems 216
Generating Logs 217
Setting the Log Level on vCenter Server Systems 217
Using DiagnosticManager 217
Using the MOB to Explore the DiagnosticManager 219
Generating Diagnostic Bundles 220
B Managed Object Browser 221
Using the MOB to Explore the Object Model 221
Accessing the MOB 221
Using the MOB to Navigate the VMware Infrastructure Object Model 222
Using the MOB to Invoke Methods 222
Passing Primitive Datatypes to Method 222
Passing Arrays of Primitives to Methods 223
Passing Complex Structures to Methods 223
C HTTP Access to vSphere Server Files 227
Introduction to HTTP Access 227
URL Syntax for HTTP Access 228
Datastore Access (/folder) 228
Host File Access (/host) 229
Update Package Access (/tmp) 230
Privilege Requirements for HTTP Access 230
D Privileges Reference 231
Privileges Required to Invoke Operations 231
Privileges Required to Read Properties 239
Privileges Defined for the Administrator Role 240
E Sample Program Overview 245
Java Sample Programs (JAXWS Bindings) 245
C# Sample Programs 249
Axis 4.1 252
VMware, Inc. 9
Contents
Index 255
vSphere Web Services SDK Programming Guide
10 VMware, Inc.
VMware, Inc. 11
The vSphere Web Services SDK Programming Guide provides information about developing applications using
theVMware® vSphere Web Services SDK 6.0.
VMware provides different APIs and SDKs for various applications and goals. The vSphere Web Services SDK
targets developers who create client applications for managing VMware
®
vSphere components available on
VMware ESX/ESXi and VMware vCenter Server systems.
To view the current version of this book as well as all VMware API and SDK documentation, go to
http://www.vmware.com/support/pubs/sdk_pubs.html.
Revision History
This book is revised with each release of the product or when necessary. A revised version can contain minor
or major changes. Table 1 summarizes the significant changes in each version of this book.
Intended Audience
This book is intended for anyone who needs to develop applications using the vSphere Web Services SDK.
Developers typically create client applications using Java or C# (in the Microsoft .NET environment) targeting
VMware vSphere. An understanding of Web Services technology and some programming background in one
of the stub languages (C# or Java) is required.
VMware Technical Publications Glossary
VMware Technical Publications provides a glossary of terms that might be unfamiliar to you. For definitions
of terms as they are used in VMware technical documentation go to http://www.vmware.com/support/pubs.
About This Book
Table 1. Revision History
Revision Date Description
04Sep2015 Updated information about migrating VMs with VMotion across data centers.
12Mar2015 vSphere 6.0 - Rewrote “Exporting a Virtual Application” section in Virtual Applications chapter.
19Sep2013 vSphere 5.5 – Added a C# example of using LoginByToken; clarified limitation for HA clusters.
10Sep2012 vSphere 5.1 – Added information about using the SessionManager.LoginByToken method; added
information about distributed virtual switches.
24AUG2011 vSphere 5.0 - Revised performance manager chapter. Added information about: unset properties, using
vCenter to access host data, and using the QueryConfigOption to add devices; emphasized ListView
instead of TaskManager; clarified limits and limitations of Linked Virtual Machines; updated samples
in chapters 3,5,14, and 16; replaced information about Axis bindings with JAX-WS; and updated paths
to samples supplied with SDK.
13JUL2010 Restructured manual and added chapters about host, storage, and networking. Revised property
collector chapter and added appendix about HTTP access.
07MAY2009 vSphere Web Services SDK 4.0 Programming Guide.
vSphere Web Services SDK Programming Guide
12 VMware, Inc.
Document Feedback
VMware welcomes your suggestions for improving our documentation. Send your feedback to
VMware, Inc. 13
1
VMware vSphere supports robust, fault-tolerant virtualized applications, networking, and storage. vSphere
offers many optional components and modules such as VMware High Availabiltiy and VMware VMotion. The
VMware vSphere Web Services SDK gives Web services developers programmatic access to vSphere
components.
The chapter includes the following topics:
“Virtualization and VMware vSphere Components” on page 13
“vSphere Development Tools” on page 14
“SDK Developer Setup” on page 15
“SDK Samples” on page 15
“UML Diagrams Used in This Guide” on page 15
Virtualization and VMware vSphere Components
VMware software products virtualize computing resources, including CPU, memory, storage, and networks.
Virtualization provides an abstraction layer between computing resources, physical storage, and networking
hardware, and the applications that use the resources.
VMware vSphere includes ESXi, vCenter Server, and several additional server products. The base products
support running and managing virtual machines. With additional licenses, you can take advantage of the
vSphere distributed resource management (DRS), disaster recovery, and high availability (HA) features.
The ESXi hypervisor is capable of supporting multiple virtual machines and other virtual components,
such as storage and networks.
vCenter Server provides central management for all of the components of a virtualized environment,
including multiple ESX/ESXi host systems, clusters, storage, and distributed virtual switches. It is
distributed in two package formats:
Windows-based software services.
Linux-based VMware vCenter Server Appliance.
vSphere Web Client is a GUI to manage vSphere. It provides the UI platform that you use to integrate your
solution with vSphere. The vSphere Web Client also includes a server-side Java platform. You can develop
Java plugins that use the vSphere Web Services SDK to communicate with vSphere servers. See the
vSphere Web Client SDK for more information about building UI and service plugins for the vSphere Web
Client.
For more information about ESXi and vCenter Server, see the VMware vSphere documentation page on the
VMware Web site. If you are new to VMware vSphere or new to the vSphere Web Services SDK, see one of
these vSphere administrator documents for background information about vSphere:
vSphere Virtual Machine Administration Guide
VMware vSphere and vSphere
Management APIs
1
vSphere Web Services SDK Programming Guide
14 VMware, Inc.
vCenter Server and Host Management Guide
vSphere Resource Management Guide
vSphere Development Tools
VMware supports SDKs and scripting tools for managing vSphere.
vSphere Web Services SDK
The vSphere Web Services SDK is the most comprehensive of the available management APIs. The SDK works
against both ESX/ESXi and vCenter Server systems. As a Web Services SDK, the SDK is language neutral. The
SDK includes stubs and examples for Java and C# and a comprehensive documentation set including an API
Reference generated from the source.
CIM APIs
The VMware CIM APIs provide a CIM (Common Information Model) interface for developers building
management applications. With the VMware CIM APIs, developers can use standards-based CIM-compliant
applications to manage ESX/ESXi hosts.
The CIM APIs include:
CIM SMASH/Server Management API – profiles compatible with the DMTF System Management
Architecture for Server Hardware (SMASH) initiative. SMASH profiles allow CIM clients to monitor
system health of a managed server.
CIM Storage Management API – profiles compatible with the Storage Management Initiative
Specification (SMI-S) of the Storage Network Industry Association. SMI-S profiles allow CIM clients to
explore the virtual machines on an ESX/ESXi host, and associated storage resources.
vSphere SDK for Perl
The vSphere SDK for Perl is an easy-to-use Perl scripting interface to the vSphere API. Administrators and
developers can work with vSphere API objects using vSphere SDK for Perl subroutines. Administrators can
use the utility applications included with vSphere SDK for Perl.
The vSphere SDK for Perl also includes the Web Services for Management component for writing scripts that
retrieve CIM data from the ESX/ESXi host using CIMOM, a service that provides standard CIM management
functions. The vSphere SDK for Perl also includes subroutines for managing the VMware Credential Store and
an example application that illustrates credential store use.
vSphere SDK for Perl is bundled with the vSphere Command-Line Interface (vSphere CLI). The vSphere CLI
command set allows you to run common system administration commands against ESX/ESXi systems from
an administration server of your choice.
vSphere PowerCLI
VMware vSphere PowerCLI provides a Windows PowerShell interface to the vSphere API. vSphere PowerCLI
includes PowerShell Cmdlets for administering vSphere components. In addition, the vSphere PowerCLI
package includes the vSphere SDK for .NET for developers who want to create their own applications.
VIX API
The VIX API is a library for writing scripts and programs to manipulate virtual machines. It is high-level, easy
to use, and practical for both script developers and application programmers. This API is well suited for
dedicated IT personnel in an organization building their own in-house tools. It might also be used by software
vendors using VIX to integrate VMware products with their own products or to build management products
for virtual machines.
VMware, Inc. 15
Chapter 1 VMware vSphere and vSphere Management APIs
Figure 1-1 gives an overview of the different vSphere APIs and CLIs and illustrates how they fit into the virtual
infrastructure.
Figure 1-1. vSphere APIs and CLIs
SDK Developer Setup
Before you can start developing applications with the vSphere Web Services SDK, you must download the
software and set up your system. The Developers Setup Guide has complete instructions for Java and C#
development and discusses a simplified secure setup for development environments.
SDK Samples
The SDK includes a set of samples that illustrate much of the SDK features. Two sample sets are available:
Java samples use the generated Java stubs that are shipped with the SDK.
C# samples use the generated C# stubs that are shipped with the SDK.
Both sample sets include a set of utility applications that are used by the sample code.
The code fragments in this guide are in part based on the Java sample applications, but present code that does
not require utility applications to run.
See Appendix E, “Sample Program Overview,” on page 245 for lists of samples for the two languages and a
brief explanation of what each sample does.
UML Diagrams Used in This Guide
This guide uses UML (unified modeling language) diagrams to illustrate the API objects and their
relationships. The guide includes class diagrams and instance diagrams. Figure 1-2 shows the UML notation
used for managed objects and data objects. The diagrams use a tilde (~) if an object has no properties or
methods. Ellipses (...) means some properties or methods are omitted.
Figure 1-2. Legend for UML Class Diagrams
vSphere Web Services SDK Programming Guide
16 VMware, Inc.
VMware, Inc. 17
2
The vSphere API is implemented as a language-neutral Web service. The API is based on a remote
procedure call mechanism that client applications use to access services and components on ESX, ESXi, and
vCenter Server systems.
This chapter includes the following topics:
“vSphere Client-Server Architecture” on page 17
“vSphere API as a Web Service” on page 18
Access to Managed Objects” on page 21
Access to vSphere Server Data” on page 21
vSphere Client-Server Architecture
VMware vSphere client applications participate in a distributed architecture that uses an asynchronous
communications model. This architecture is based on server-side managed objects, client-side managed object
references, and data objects.
Managed objects exist on a vSphere server (ESX/ESXi or vCenter Server system). They represent vSphere
services and components. Services include PropertyCollector, SearchIndex, PerformanceManager,
and ViewManager. Components include inventory objects such as VirtualMachine, Datastore, and
Folder.
Managed object references are client application references to server-side managed objects. Your client
application uses ManagedObjectReference objects when it invokes operations on a server. A
ManagedObjectReference is guaranteed to be unique and persistent during an object's lifetime. The
reference persists after an object has moved within the inventory, across sessions, and across server
restarts. If you remove an object, for example, a virtual machine, from the inventory, and then put it back,
the reference changes.
Data objects contain information about managed objects. Your client application sends data objects to and
receives data objects from a vSphere server. Examples are the different specification and capability objects
such as VirtualMachineConfigSpec and HostCapability.
Figure 2-1 shows a vSphere server and client application. The client has a managed object reference to a virtual
machine on the server, and a copy of the GuestInfo data object for the virtual machine. A client must maintain
its copy of a data object because, depending on the type of client request, a vSphere server might send property
data for a data object as a set of name-value pairs associated with a managed object reference. See the
description of the ObjectContent data object in the vSphere API Reference.
vSphere API Programming Model
2
vSphere Web Services SDK Programming Guide
18 VMware, Inc.
Figure 2-1. vSphere Server and Client
The VMware vSphere application model uses an asynchronous client-server communication model in most
cases. Methods are nonblocking and return a reference to a Task managed object. See Chapter 14, “Tasks and
Scheduled Tasks,” on page 167.
vSphere API as a Web Service
The vSphere API is a language-neutral Web service that runs on ESX/ESXi and vCenter Server systems. The
vSphere API complies with the Web Services Interoperability Organization (WS-I) Basic Profile 1.0. The WS-I
Basic Profile 1.0 includes support for:
XML Schema 1.0
SOAP 1.1
WSDL 1.1
For information about the WS-I Basic Profile 1.0, go to the Web Services Interoperability Organization (WS-I)
Web site at http://www.ws-i.org.
Web services support operations, which are the same as methods in other programming languages. The
vSphere API Web service provides access to all operations necessary for monitoring and managing vSphere
components, such as compute resources, virtual machines, networks, storage, and so on.
WSDL Files and the Client-Side Proxy Interface
The vSphere Web Services SDK provides a set of WSDL (Web Services Description Language) files that define
the vSphere Web Services API. Web-services development tools such as JAX-WS wsimport, or Microsoft .NET
wsdl.exe use these WSDL files to generate client-side proxy code (stubs).
The client proxy provides a language-specific vSphere API, for example, using Java or C#. The proxy facilitates
remote method invocation, organization of object data, and other aspects of distributed, object-oriented,
applications programming. Your client application calls proxy interface methods. The client proxy uses SOAP
(Simple Object Access Protocol) to exchange WSDL messages with a vSphere server.
Figure 2-2 is a representation of a client application that uses the client proxy interface to call a method. The
client proxy interface is based on the WSDL definitions.
vSphere server
VirtualMachine
managed object
vSphere client application
GuestInfo
data object
GuestInfo
data object
managed object
reference to a
VirtualMachine
data objects
network
connection
VMware, Inc. 19
Chapter 2 vSphere API Programming Model
Figure 2-2. Client-Server Communication Through a Client Proxy Interface
To use the VMware client proxy interface, you must import the vSphere API client libraries in to your client
application using the following Java and C# statements.
Network Access to the vSphere Web Service
Your client application can use the vSphere API to communicate with vSphere servers over HTTPS (HTTP over
an encrypted Secure Sockets Layer connection) at port 443. HTTPS is the default protocol. You can configure
the server to support HTTP. Use HTTP access only for test or development environments, not for production.
See the Developer’s Setup Guide for details.
Language-Specific Classes and Methods
The SOAP tools generate language-specific classes and methods that match the WSDL definitions. The tools
also produce objects and methods that are not in the WSDL files.
Generated objects. The additional objects provide access to the vSphere Web Service to establish the
client-server connection (VimServiceLocator, AppUtil) and declare the methods defined for the
vSphere API (VimPortType, VimService).
Generated methods. The additional methods are accessor (getter) and mutator (setter) methods for
properties. For Java, the method names are constructed by adding get and set prefixes to a property
name, and changing the first character of the property name to upper case.
C# using VimApi;
Java import com.vmware.vim25.*;
I
MPORTANT The vSphere Web Services SDK includes Java client-side proxy code that was generated using
the JAX-WS toolkit. If the versions of Java and JAX-WS on your development platform are the same as those
used to generate the proxy interface shipped in the SDK, you do not have to generate client-side proxy code
from the WSDL. See the Developer’s Setup Guide for information about configuring a development environment
for the vSphere Web Services SDK.
client application
vSphere Server
method
execution
method
invocation
SOAP-encoded WSDL
network
connection
WSDL2Java,
wsdl.exe, or
other tool
WSDL
files
client
proxy
interface
(Java, C#,
or other)
vSphere Web Services SDK Programming Guide
20 VMware, Inc.
Table 2-1 identifies client proxy definitions for the vSphere Web Services SDK WSDL.
The following code fragments show getter and setter method declarations for the
AfterStartupTaskScheduler.minute property.
Java
public int getMinute() {
return minute; }
public void setMinute(int minute) {
this.minute = minute; }
C#
public int minute {
set; get; }
You can extrapolate the getter and setter methods that are available in the client proxy interface from the
vSphere API Reference. For example, the ScsiLun data object has a displayName property. For the Java API,
you can use a setDisplayName method to assign a string value to the property, and obtain the string value by
using the getDisplayName method. The vSphere Web Services SDK includes Java and C# sample code that
illustrates using the proxy interfaces. See Chapter 3, “Client Applications,” on page 27.
Mapping XML Data Types to Java and C# Data Types
In this guide, the UML class and object diagrams use the primitive data type names such as string and integer,
without the XML Schema definition namespace prefix (xsd:). The vSphere API Reference contains the complete
data type name, such as xsd:string. The data types map to the primitive data types of the programming
language used for the client application.
Table 2-2 lists some of the more common XML primitive data type mappings.
Table 2-1. Client Proxy Definitions
Element Access Java C#
Access to vSphere
Web service
(HTTPS/HTTP)
VimServiceLocator class AppUtil class
Access to vSphere
API methods
VimPortType class VimService class
Access to vSphere
API properties
get
PropertyName
and set
PropertyName
methods defined for data objects
get and set methods defined for properties
vSphere API data
objects
Data objects in the vSphere API (see the vSphere API Reference) defined as objects in the proxy
interface
Table 2-2. Standard XML Schema Primitives to Java and .NET Data Type Mappings
XML Schema Java .NET Data Type
xsd:base64binary byte[] Byte[]
xsd:boolean boolean Boolean
xsd:byte byte SByte
xsd:dateTime java.util.Calendar DateTime
xsd:decimal java.math.BigDecimal Decimal
xsd:double double Double
xsd:float float Single
xsd:int int Int32
xsd:string java.lang.String String
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114
  • Page 115 115
  • Page 116 116
  • Page 117 117
  • Page 118 118
  • Page 119 119
  • Page 120 120
  • Page 121 121
  • Page 122 122
  • Page 123 123
  • Page 124 124
  • Page 125 125
  • Page 126 126
  • Page 127 127
  • Page 128 128
  • Page 129 129
  • Page 130 130
  • Page 131 131
  • Page 132 132
  • Page 133 133
  • Page 134 134
  • Page 135 135
  • Page 136 136
  • Page 137 137
  • Page 138 138
  • Page 139 139
  • Page 140 140
  • Page 141 141
  • Page 142 142
  • Page 143 143
  • Page 144 144
  • Page 145 145
  • Page 146 146
  • Page 147 147
  • Page 148 148
  • Page 149 149
  • Page 150 150
  • Page 151 151
  • Page 152 152
  • Page 153 153
  • Page 154 154
  • Page 155 155
  • Page 156 156
  • Page 157 157
  • Page 158 158
  • Page 159 159
  • Page 160 160
  • Page 161 161
  • Page 162 162
  • Page 163 163
  • Page 164 164
  • Page 165 165
  • Page 166 166
  • Page 167 167
  • Page 168 168
  • Page 169 169
  • Page 170 170
  • Page 171 171
  • Page 172 172
  • Page 173 173
  • Page 174 174
  • Page 175 175
  • Page 176 176
  • Page 177 177
  • Page 178 178
  • Page 179 179
  • Page 180 180
  • Page 181 181
  • Page 182 182
  • Page 183 183
  • Page 184 184
  • Page 185 185
  • Page 186 186
  • Page 187 187
  • Page 188 188
  • Page 189 189
  • Page 190 190
  • Page 191 191
  • Page 192 192
  • Page 193 193
  • Page 194 194
  • Page 195 195
  • Page 196 196
  • Page 197 197
  • Page 198 198
  • Page 199 199
  • Page 200 200
  • Page 201 201
  • Page 202 202
  • Page 203 203
  • Page 204 204
  • Page 205 205
  • Page 206 206
  • Page 207 207
  • Page 208 208
  • Page 209 209
  • Page 210 210
  • Page 211 211
  • Page 212 212
  • Page 213 213
  • Page 214 214
  • Page 215 215
  • Page 216 216
  • Page 217 217
  • Page 218 218
  • Page 219 219
  • Page 220 220
  • Page 221 221
  • Page 222 222
  • Page 223 223
  • Page 224 224
  • Page 225 225
  • Page 226 226
  • Page 227 227
  • Page 228 228
  • Page 229 229
  • Page 230 230
  • Page 231 231
  • Page 232 232
  • Page 233 233
  • Page 234 234
  • Page 235 235
  • Page 236 236
  • Page 237 237
  • Page 238 238
  • Page 239 239
  • Page 240 240
  • Page 241 241
  • Page 242 242
  • Page 243 243
  • Page 244 244
  • Page 245 245
  • Page 246 246
  • Page 247 247
  • Page 248 248
  • Page 249 249
  • Page 250 250
  • Page 251 251
  • Page 252 252
  • Page 253 253
  • Page 254 254
  • Page 255 255
  • Page 256 256
  • Page 257 257
  • Page 258 258
  • Page 259 259
  • Page 260 260
  • Page 261 261
  • Page 262 262

VMware vSphere Web Services SDK 6.0 User guide

Category
System management software
Type
User guide

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI