Extract the Session Cookie in Java
Last Updated December 16, 2024

After calling the
loginByToken
, you extract the session cookie, as shown in the following example.
Extract the Session Cookie
// Step 4 Extract the session cookie that is established in the previous
// call to the server.
String cookie = cookieExtractor.getCookie();
// Clear the HandlerResolver chain setup in step 3 as that is
// required only one time for the invocation of the LoginByToken method.
// After login we do not need this handler thus reverting to the
// original (default) handler.
vimService.setHandlerResolver(defaultHandler);
vimPort = vimService.getVimPort();