LoginByToken to vCenter
Server By Using Java
The following example is based on the
LoginByTokenSample.java file
contained in the vCenter Single Sign On SDK. The SDK contains Java code that
supports HTTP and SOAP header manipulation.
vCenter Server Single Sign-On Session Using Java After you obtain a SAML token from the vCenter Single Sign-On Server, you can use the vSphere Web Services API method LoginByToken to establish a vCenter Single Sign-On session with a vCenter Server. At the beginning of the session, your client is responsible for the following tasks: HTTP and SOAP Header Handlers in Java To use a vCenter Single Sign On token to login to a vCenter Server, the example uses header handlers to manipulates the HTTP and SOAP header elements of the login request. After establishing a handler, subsequent requests automatically invoke the handler. Creating the HTTP Connection in Java The code fragment in this section establishes an HTTP session with the vCenter Server and saves the HTTP session cookie. Using LoginByToken in Java The code fragment in this section sets up the message handlers and calls the LoginByToken method to get the session cookie. The following sequence describes the steps and shows the corresponding objects and methods.