VMware {code} Community
bcraig695
Contributor
Contributor

Login to host Web Services API with vCenter Ticket?

Our team has successfully created a C++ application that connects to an ESXi host Web Services API using a valid ESXi host username/password and then can perform all sorts requests and get responses.  We now want to be able to do this same this, but using the Ticket retrieved from vCenter using the AcquireCimServicesTicket.  I realize this method says it is only for CIM, but I was hoping it could be made to work for the Web Services Login with the LoginRequestType. For CIM access, the SessionID returned in the ticket is used as the username/password when connecting to the CIMOM.  However, when I tried it, I get an error saying invalid username or password.

If using that ticket just won't work, is there some other credential that can be retrieved from vCenter to access the ESXi host Web Services without requiring use of an ESXi host username/password.  Or, are we stuck doing all of our requests through vCenter?

0 Kudos
1 Reply
stumpr
Virtuoso
Virtuoso

You can do it, though you'll need to register an extension with an SSL client certificate.  Then you can call LoginExtensionByCertificate (vSphere 4.0 +).

You also have to deal with the fact the default SDK endpoint (:443/sdk) does not handle client certs.  So you have to go through the vSphere API Proxy endpoint.  There's a discussion of it for Java here.  I do have a sample working in Perl, though that might not be as useful. 

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos