Creating the HTTP
Connection in JavaLast Updated December 16, 2024
The code fragment in this section
establishes an HTTP session with the vCenter Server and saves the HTTP session
cookie.
The following sequence describes these steps and
shows the corresponding objects and methods.
1 | Use the
getHandlerResolver method
to save the default message handler. To use the HTTP and SOAP message handlers,
you must first save the default message handler so that you can restore it
after login. The HTTP and SOAP message handlers impose overhead that is
unnecessary after
login. | VimService.getHandlerResolver(
)
|
2 | Get the VIM port. The VIM port
provides access to the vSphere API methods, including the
LoginByToken
method. | ![]() |
3 | Set the request context endpoint
address to the vCenter Server URL. | ![]() |
4 | Retrieve the ServiceContent. This
method establishes the HTTP connection. | ![]() |
The following example shows Java code that saves
the session cookie.
Saving the vCenter Server Session
Cookie