One of the first things I did after I signed-up for the Microsoft Developer Network (MSDN) was downloading Visual Studio 2008. Iāve installed Visual Studio 2008 in a newly created Windows 2008 virtual machine and copied the vSphere Web Service SDK to the root of this VM.
Before you can start with building the Samples (C:\Web Service SDK\SDK\samples\DotNet) you have to generate the stubs, Paul Davey over at Xtravirt has created a real good work around for Visual Studio 2008.
ā¢Ā Open the visual studio command prompt.
⢠Enter the following: set VSINSTALLDIR="C:\All My Apps\Microsoft Visual Studio 9"
ā¢Ā Copy the two WSDL files that you want to use (either 2.5 or 2.0) to the \SDK\samples\DotNet folder
ā¢Ā In the visual studio command prompt, change directory to the \SDK\samples\DotNet folder
ā¢Ā Enter the following command: genvimstubs.cmd .\
If you donāt want to hassle with building your own (VimService2005.dll) and (VimService2005.XmlSerializers.dll) or youāre a bit lazy, thereās an alternative. You can install Xtravirtās RDP plug-in and copy the two dll files from the program files directory (C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\XtravirtRDP) to the Samples DotNet directory (C:\Web Service SDK\SDK\samples\DotNet). Now you can start build the C# (.NET) samples using Microsoft Visual Studio 2008.
ā¢Ā Start Visual Studio 2008
ā¢Ā Go to the menu option File ā Open ā Project/Solution
ā¢Ā Navigate to the C:\Web Service SDK\SDK\samples\DotNet\cs\ Samples2005.sln file.
Youāre now about to start the Visual Studio Conversion Wizard because the Samples2005.sln was created in a previous version of Visual Studio. It must be converted to the format used by Visual Studio 2008. Click <Next> to proceed.
After the conversion go to the menu option Project/ Add Reference, click the Browse tab and locate the (VimService2005.dll) and (VimService2005.XmlSerializers.dll) files.
Check out the label of the namespace, if namespace name is not 'Vim25Api' you have to do a quick Find and Replace from the edit menu. For instance, replace āVim25Apiā with āVimApiā.
Go to your Solution Explorer and locate the SimpleClient2005, this is a simple standalone client whose purpose is to demonstrate the process for Logging into the Webservice, and get Container contents starting at the root Folder available in the ServiceInstanceContent.Ā Right click it and choose for the Build option. After the build is complete open a command prompt and navigate to the newly build executable.Ā Execute te following command:
C:\Web Service SDK\SDK\samples\DotNet\cs\SimpleClient\bin\Debug>SimpleClient.exe "https://192.168.178.250/sdk" "administrator" "vmware"
A list with all your virtual machine will scroll over the screen. Iāve created some screen dumps of te whole process, have fun and donāt forget to sign upĀ VMware's Script-O-Mania contest.