I have upgraded my vimservice2 to vimservice 2.5 and it does not work with ESX 3.0.2. I am getting exception "unsupported namespace in content of SOAP body".
i have downloaded SDK4.0 and documentation tells us that it has samples to use different versions of vimservice.
In Samples I found one class VersionUtil which is getting the supported version but no one in the samples is using that class.
So I could not find a way to use it.
I would like to know how I can use vimservice for different ESX versions.
Thanks
I'm not a usual Java user, but I have looked at that Util code. It just gets the vimService.wsdl file and parses it to get the vim namespace version. You'll need to use an older version compatible with 3.0.2 (not 2.5). v4 also uses namespace 2.5 as well (vim25).
You can decide which version of the SDK to use based on the response (though v4 uses the same namespace as 3.5 so you'll need to do some additional version checking to avoid using v4 calls vs 3.5).
In my case one client needs to connect with vimservice2 as well as with vimservice2.5 simultaneously.
How can we connect to both vimservices in one client?
How do I link to both vim2 dll and vim25 dll?
This is from VSphere 4.0 webservice SDK Programming guid page 63. How do we set the VersionID in the soapAction attribute? Can someone provide the .net code sample?
"Client applications convey information about the API version used in the SOAP messages they send to a
vSphere server. These SOAP messages include a versionID in the soapAction attribute. The details are
handled transparently by the SOAP toolkit and the client proxy code. The server adjusts its behavior as needed
based on the client's version information, exposing to the client the API version supported by the client."
You receive unsupported namespace error as prior version ESX dont recognise vim25 namespace. In case you want your client to use both vim2 and vim25 namespace then you must use vim2 for default connection, incase you are interested in some features which were introduced since vim25 then, change your version to vim25 as the newly added features wont be available with vim2 objects.
The versionID mentioned is the cookieString that need to be set in the SOAP header, the C# psuedo code for this as follows:
_service = new VimService();
_service.Url = url;
_service.Timeout = 600000; / /The value can be set to some higher value also.
_service.CookieContainer = new System.Net.CookieContainer();
_service.CookieContainer.Add(cookie); //cookie is the string saved from earlier request made using vim2
_sic = service.RetrieveServiceContent(svcRef);
Please refer DisplayNewPropertiesHost sample along the vi-sdk-4.0.0-161137. the library class VersionUtil.cs contains functions to explain how to getSupported APIs list , chnage vim2 object into vim25 object etc.