VMware {code} Community
Matt65
Contributor
Contributor
Jump to solution

Where to start with Web Services

We are running an ESXi 5 environment with a vSphere server and are wanting to develop a system to be able to create new virtual machines.

I came across the VMware Developer site and was very happy to find the vSphere Web Services SDK and wanted to know where do I begin?

Is there any software or settings that need to be enabled on the vSphere server or the ESXi hosts to enable the use of the SDK?  I have downloaded the SDK and attempted to connect and haven't had any success as yet and would like to rule out that something isn't missing on the server.

Is there any introduction level sites, blogs, or tutorials on how to begin using the SDK?

I would appreciate any assistance anyone is able to provide.

Thanks,

Matt

Reply
0 Kudos
1 Solution

Accepted Solutions
nikhilxp64
Enthusiast
Enthusiast
Jump to solution

Hi Matt,

Everything you need to get started is available here: http://www.vmware.com/support/developer/vc-sdk/

This has links for:

1. The Developers Guide

2. The Programming Guide

3. The API reference online

4. The SDK download (if you haven't got it already)

The developers setup guide gives you all the steps for setting up your system and how to compile the samples. I would suggest you go through that first and get to the point where you can successfully run the basic sample program that connects to the ESXi host and retrieves a few values.

The developers setup guide is segregated into separate sections for Java and C#. I am using C#, and the guide was spot on in everything.

The next document to read is the vSphere Web Services SDK Programming Guide - it will help you understand all the concepts you need to program with the SDK. The information is presented in a generic way but the samples lean towards Java. But not to worry because the SDK C# samples are numerous and it's easy to cross reference stuff between the Programming Guide and a sample program. This guide is very large ~250 pages, but you don't need to read the whole thing, Chapters 2-5 are what I concentrated on - they present the absolute must know things for leveraging the web services SDK. Everything after that I would say depends on what you need to do with the SDK. A very useful reference while reading chapters 2-5 is the Managed Object Browser (MOB) on your ESXi host. It can be accessed at https://your-host-url/mob.You can look up Managed Objects and explore their hierarchy here.

Once you have that figured out, I dare say you are in a position to start your own program with the help of the API reference of course. In fact you might have already tried poking around with a few lines of code while reading the guide just because it helps to understand concepts by testing them out with code. Smiley Wink

Also nothing has to be done on the server to start using the web services SDK.

View solution in original post

Reply
0 Kudos
4 Replies
nikhilxp64
Enthusiast
Enthusiast
Jump to solution

Hi Matt,

Everything you need to get started is available here: http://www.vmware.com/support/developer/vc-sdk/

This has links for:

1. The Developers Guide

2. The Programming Guide

3. The API reference online

4. The SDK download (if you haven't got it already)

The developers setup guide gives you all the steps for setting up your system and how to compile the samples. I would suggest you go through that first and get to the point where you can successfully run the basic sample program that connects to the ESXi host and retrieves a few values.

The developers setup guide is segregated into separate sections for Java and C#. I am using C#, and the guide was spot on in everything.

The next document to read is the vSphere Web Services SDK Programming Guide - it will help you understand all the concepts you need to program with the SDK. The information is presented in a generic way but the samples lean towards Java. But not to worry because the SDK C# samples are numerous and it's easy to cross reference stuff between the Programming Guide and a sample program. This guide is very large ~250 pages, but you don't need to read the whole thing, Chapters 2-5 are what I concentrated on - they present the absolute must know things for leveraging the web services SDK. Everything after that I would say depends on what you need to do with the SDK. A very useful reference while reading chapters 2-5 is the Managed Object Browser (MOB) on your ESXi host. It can be accessed at https://your-host-url/mob.You can look up Managed Objects and explore their hierarchy here.

Once you have that figured out, I dare say you are in a position to start your own program with the help of the API reference of course. In fact you might have already tried poking around with a few lines of code while reading the guide just because it helps to understand concepts by testing them out with code. Smiley Wink

Also nothing has to be done on the server to start using the web services SDK.

Reply
0 Kudos
Matt65
Contributor
Contributor
Jump to solution

Thanks Nik,

I have been able to successfully run the connect sample script.  I am not sure what I was doing wrong the other night when I first tried and so wasn't sure where to begin.

I started from scratch and have had success Smiley Happy

The only issue I had, and one that I was able to resolve the other night but cant find the site that showed me what to do, was when compiling the Vim25Service2008.XmlSerializers.dll the sgen /p command kept returning a CS0001 and CS0003 error.  My environment is Windows 7 x64 with 8GB RAM (closed all but a couple of applications, leaving a lot of free space) and plenty of available HDD space.  I am running the .NET Developer SDK 7.1 x64.

As I said, I did manage to fix this the other night, so I just used the DLL's I built then.  For my reference would you have any ideas on how to overcome this (in case I have to rebuild these DLL's in the future).

Thanks very much for your help, it is greatly appreciated.

Matt

Reply
0 Kudos
nikhilxp64
Enthusiast
Enthusiast
Jump to solution

I have not had a problem yet with the sgen tool on Windows 7 x64. Can't say I know what could be going wrong there.

Reply
0 Kudos
Steve_Jin
Expert
Expert
Jump to solution

Web Services API is too low level and not very productive. Check out this tutorial and get your first app running in 5 minutes:

http://vijava.sourceforge.net/doc/getstarted/tutorial.htm

More samples:

http://vijava.svn.sourceforge.net/viewvc/vijava/trunk/src/com/vmware/vim25/mo/samples/

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
Reply
0 Kudos