6.0
Table Of Contents
- vSphere Web Services SDK Developer’s Setup Guide
- Contents
- About the vSphere Web Services SDK
- Knowledge Required for Using the vSphere Web Services SDK
- Programming Languages Supported by the vSphere Web Services SDK
- Types of Applications That You Can Build Using This SDK
- Downloading the vSphere Web Services SDK
- vSphere Web Services SDK Package Contents
- SDK Versions and VMware vSphere Product Compatibility
- Setting Up for Java Development
- Setting Up for Microsoft C# Development
- vSphere Server Certificates
- Scripting the C# DLL Build
- Index
VMware, Inc. 19
Chapter 3 Setting Up for Microsoft C# Development
To set environment variables
1 Open a Visual Studio command shell window.
2 Create the WSE_HOME environment variable, setting its value to the absolute path to the directory where
WSE was installed. For example:
set WSE_HOME="C:\Program Files (x86)\Microsoft WSE\v3.0"
3 Add the WSE tools directory to the PATH environment variable:
set PATH=%PATH%;%WSE_HOME%\Tools
4 Create the WS_SDK_HOME environment variable, setting its value to the absolute path to the directory
containing all the SDK files extracted from the zip file you downloaded. For example:
set WS_SDK_HOME="C:\Documents and Settings\yourusername\My Documents\Downloads\SDK"
5 Create the WSDLHOME environment variable, setting its value to the absolute path to the directory
where the WSDL files were stored when you uncompressed the SDK download file. For example:
set WSDLHOME=%WS_SDK_HOME%\vsphere-ws\wsdl\vim25
6 If your Microsoft development and .NET software was not installed using default paths, create and set the
VSINSTALLDIR environment variable to contain the location where the software was installed. For
example:
set VSINSTALLDIR="C:\devstuff\Microsoft Visual Studio 8\SDK"
Building the C# SSO DLL
In the vSphere Web Services SDK, VMware supplies several sample Single Sign-On (SSO) clients for Visual
Studio 2008. The SDK includes a project (.csproj) file for each sample, and a solution (.sln) file for the whole
set of samples. The project files reference the DLL through which a client communicates with the SSO service.
The samples demonstrate how to authenticate with the SSO service, using the methods available to vSphere
clients. The methods include the use of user credentials to authenticate and retrieve bearer and Holder-of-Key
(HoK) tokens. You can use these methods to authenticate when running vSphere samples or other clients, such
as the SimpleClient sample described in “Running the Microsoft .NET C# Version of SimpleClient” on
page 23.
Build the C# SSO DLL
The samples in the SDK contain code to authenticate with an SSO server. Before you run the SDK samples, you
must build the SSO DLL.
Prerequisites for Building the C# SSO DLL
install a C# development environment, as described in “Setting Up for C# Development” on page 17.
Open a Visual Studio command shell window and set environment variables as described in “Set
Environment Variables To Build C# DLLs and Samples” on page 18.
To Build the C# SSO DLL
1 Open a Visual Studio Tools command shell.
2 Navigate to the .NET subdirectory for SSO client samples.
cd %WS_SDK_HOME%\ssoclient\dotnet\cs\samples
3 Generate a test certificate and STSService stubs using the build.bat script.
.\build.bat
4 Copy the SSO DLL to the %SDK_HOME%\vsphere-ws\dotnet\cs\samples\lib directory for use by the
vSphere sample clients.
copy lib\STSService.dll %WS_SDK_HOME%\vsphere-ws\dotnet\cs\samples\lib\.