VMware {code} Community
nikhilxp64
Enthusiast
Enthusiast

Problems connecting to ESXi host with Samples from vSphere SDK

I am trying to control an ESXi host via the vSphere SDK. After successfully compiling the .NET samples on my Windows 7 machine I am unable to connect to the ESXi host. I have tried SimpleClient and Connect but had no success.

I have tried:

CommandOutput
Connect.exe --url 192.168.x.x --username root --password mypasswordCaught Exception :  Name : UriFormatException
Connect.exe .exe --url http://192.168.x.x --username root --password mypasswordCaught Exception :  Name : WebException Message : The request failed with the error message:
--
<HTML><BODY><H1>301 Moved Permanently</H1></BODY></HTML>
Connect.exe --url https://192.168.x.x --username root --password mypasswordStarted
There were one or more problems with the server certificate:

* A certification chain processed correctly, but terminated in a root certificat
e which isn't trusted by the trust provider.

* The certificate's CN name does not match the passed value.


Caught Exception :  Name : WebException Message : The request failed with HTTP s
tatus 400: Bad Request.
SimpleClient.exe 192.168.x.x root mypasswordCaught Exception :  Name : UriFormatException Message : Invalid URI: The format of the URI could not be determined.
SimpleClient.exe http://192.168.x.x root mypassword

Caught Exception :  Name : UriFormatException Message : Invalid URI: The format
of the URI could not be determined.

SimpleClient.exe https://192.168.x.x root mypasswordCaught Exception :  Name : UriFormatException Message : Invalid URI: The format
of the URI could not be determined.

I am able to connect to the ESXi hose using the vSphere client. What am I doing wrong here?

Initially I thought that it was because I needed vCenter to invoke the web services on the ESXi host, but after reading a few white papers I came to the conclusion that vCenter was not necessary to control the ESXi host with the vSphere SDK.

Also since one of the outputs gave me the usual certificate warning I'm assuming the sample did indeed reach the host and receive a reply, I'm just not sure why the connect was still unsuccessful. Maybe I'm not using the right URL and hence the HTTP 400 I got back. I'm also assuming from the 301 that the host only wants to accept HTTPS connections.

Any pointers would be appreciated.

Reply
0 Kudos
3 Replies
tos2k
Expert
Expert

Hi!

Maybe you should try with https://<ip>/sdk

Tos2k

nikhilxp64
Enthusiast
Enthusiast

Thanks, I noticed "https://"+serverName+"/sdk/vimService" in the programming guide which works. But just "/sdk" works too.

Thanks! Smiley Happy

Reply
0 Kudos
oxment
Contributor
Contributor

When I run the following command, I will connect successfully but I get certification error.

Connect.exe --url https://x.x.x.x/sdk/vimService --username svc.vcloud --password !vCloud

[ 4/16/2013 9:27:17 AM ] Begin Log.
Started
There were one or more problems with the server certificate:
* A certification chain processed correctly, but terminated in a root certificate which isn't trusted by the trust provider.
Connected Successfully
Server Time -: 4/16/2013 1:27:30 PM
Press enter to exit.
Do you know how can I fix this? or use HTTP instead oc HTTPS?
Reply
0 Kudos