Hi,
Please help..... Tried everything I can think of now before posting here.
Trying to get C# talking to VMware webservices so I can create virtual machines automatically.
I am having major difficulties getting started - Ive read through all the docs - but cannot get sdk to login to either the VI or the ESX servers.
From fresh Install of XP Pro and Visual Studio and the following - I get only "WebException Message : The request failed with HTTP s
tatus 400: Bad Request."
3 Machines - One Development, One VirtualCenter, One ESX server.
Install ok as I can use VMware Client tools to browse both VirtualCenter and ESX server directly.Problem is with code access.
Visual Studio 2008 Pro on WinXp SP3 IE7 (running on a dev machine with VMWare Client only installed - not part of domain)
vi-sdk-2.5.0-64154[Webservices VMware Infrastructure SDK ] - installed on dev machine
esx-3.5.0_Update_1-82663[http://ESX Server3.5|http://ESX Server3.5] (running in a VM Session)
VMware-VIMSetup-2.5.0-84782[VirtualCenter and Licence websevice].iso (running on XP Sp3 in another VmWare)
built the dlls ok: VimService2005.dll & VimService2005.XmlSerializers.dll
I have turned off the SSL on the ESX machine to remove SSL being the problem - didnt help.
(Documentation in SDK 2.5 didnt match ESX - but I found docs elsewhere on how to do this)
I have run the SDK Browser sample on the VIMSetup machine to remove the SSL cert issue with the VI.
(Note: The Virtual Center machine does not match documentation again.
Docs (/SDK/SDK.VC/WebService/samples/README.html) say there is a file to turn off ssl:
C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\VMA\vmaConfig.xml
but this file doesnt exist.) Couldnt find matching docs to turn off ssl.
I've tried the "add vmware to the hosts file and use https://vmware to access the VI " trick I found on the net
- removes the SSL errors, but doesnt cure the problem - and the problem seems after the SSL errors are ignored.
I have also tried Installing VS2005 (not 2008) and the VI 2.5 SDK on the VI machine and rebuilt dlls - no luck - same error.
The errors to basic login code from the "Browser" sample I get are as below.
Same error for all samples and all code samples Ive tried from elsewhere.
string[] args = new string[] { @"https://vmware", "admin","admin" };
Browser bc = new Browser("Browser", args);
RunDelegate rd = new RunDelegate(bc.DoBrowse);
bc.Run(rd);
Started Browser
Caught Exception : Name : WebException Message : The request failed with HTTP s tatus 400: Bad Request. Trace : at System.Web.Services.Protocols.SoapHttpClie
ntProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream
responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
at VimApi.VimService.RetrieveServiceContent(ManagedObjectReference _this)
at ClientUtils.SvcConnection.Connect(String url, String username, String pass
word) in D:\VirtualMachines\SDK\SDK.VI\samples\DotNet\cs\ClientUtils\SvcConnecti
on.cs:line 57
at ClientUtils.ServiceUtil.ClientConnect() in D:\VirtualMachines\SDK\SDK.VI\s
amples\DotNet\cs\ClientUtils\ServiceUtil.cs:line 29
Exception running : Browser
Caught Exception : Name : WebException Message : The request failed with HTTP s
tatus 400: Bad Request. Trace : at ClientUtils.ServiceUtil.ClientConnect() in
D:\VirtualMachines\SDK\SDK.VI\samples\DotNet\cs\ClientUtils\ServiceUtil.cs:line
32
at ClientUtils.ClientBase.Run(RunDelegate runDelegate) in D:\VirtualMachines\
SDK\SDK.VI\samples\DotNet\cs\ClientUtils\ClientBase.cs:line 54
Caught Exception : Name : NullReferenceException Message : Object reference not
set to an instance of an object. Trace : at ClientUtils.SvcConnection.Discon
nect() in D:\VirtualMachines\SDK\SDK.VI\samples\DotNet\cs\ClientUtils\SvcConnect
ion.cs:line 114
at ClientUtils.ServiceUtil.ClientDisconnect() in D:\VirtualMachines\SDK\SDK.V
I\samples\DotNet\cs\ClientUtils\ServiceUtil.cs:line 41
Exception disconnecting.
Caught Exception : Name : NullReferenceException Message : Object reference not
set to an instance of an object. Trace : at ClientUtils.ServiceUtil.ClientDi
sconnect() in D:\VirtualMachines\SDK\SDK.VI\samples\DotNet\cs\ClientUtils\Servic
eUtil.cs:line 44
at ClientUtils.ClientBase.Run(RunDelegate runDelegate) in D:\VirtualMachines\
SDK\SDK.VI\samples\DotNet\cs\ClientUtils\ClientBase.cs:line 62
Ended Browser
thanks in advance.
Ambrose.
Hi Ambrose,
It seems to be an issue in the url provided to connect to ESX server or VirtualCenter. Try to connect to the ESX or VC using the url format as https://<ESX or VC IP>/sdk.
Hope the above information is helpful.
Regards,
Neha
Hi Ambrose,
It seems to be an issue in the url provided to connect to ESX server or VirtualCenter. Try to connect to the ESX or VC using the url format as https://<ESX or VC IP>/sdk.
Hope the above information is helpful.
Regards,
Neha
thanks njain - that helps a lot.
Can anyone point me in the right direction for a document that shows how to update the SSL
cert to a self signed one (or even turn off SSL) on the VI webservice server.
thanks,
a.
Try using --ignorecert option to turn-off SSL.
Hi,
In order to turn off SSL, the ESX Server and VirtualCenter Server can be configured to support HTTP. Please refer to the section "Modifying the Server Configuration to Support HTTP" on page 14 in Developer's Setup Guide (http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25setupguide.pdf) for details.
Hope the above information is helpful.
Regards,
Neha