We wanted to let you know we ran a very successful vSphere SDK lab at [Partner Exchange / Tech Exchange a few weeks ago in Orlando. For those of you who missed the event, I'm posting the manuals and code files. Going through the lab is a great way to get started with the API and includes handy sample code for modification or inclusion in your own programs.
The lab covers both the Java and C# versions of the VI SDK and uses the vSphere Web Services SDK 4.0 (formerly VI SDK 4.0). Though the lab doesn't cover any vSphere-specific features, I haven't tested it with VI SDK 2.5 and it will probably require some minor modification. For scripters that would prefer an introduction to the vSphere Perl SDK (formerly the VI Perl Toolkit) or the vSphere PowerCLI (formerly VI Toolkit for Windows), I posted a similar lab for those in an earlier blog post.
Exercises cover all the basics for using the SDK:
Understanding managed objects and data objects
Connecting to the VI API webservice
getting the properties of managed objects using the PropertyCollector
Using the SearchIndex
Finding objects using TraversalSpecs
Finding objects based on arbitrary criteria
Collecting properties of multiple objects at the same time
Understanding performance differences in some basic property collection strategies
Monitoring properties for changes
Monitoring tasks for completion
Gathering performance statistics
There's obviously a lot more to do in the SDK, but once you've mastered those basic skills, most of the rest of the SDK is just an extension of what you already know. The exercises on collecting multiple objects properties at the same time and understanding performance differences due to property collector strategies cover some common problems I see with the management ecosystem partners I handle and are a great review for anyone trying to make sure their SDK code scales well.
A few things to note: I didn't update the doc with the new names of the various API components... I wrote the lab while those names were still under development. Also, I want to thank the other folks who helped put this lab together: Balaji Parimi (who wrote the Java code), Rajesh Kamal (who wrote the C# code), Alton Yu, John Kennedy, Paul Vasquez, and Steve Jin.
While most of the code handles errors gracefully and follows best practices, I’d like to point out that the code here is designed to teach concepts, not to be “enterprise ready”.