/** * @return the current session string in format like: * vmware_soap_session="B3240D15-34DF-4BB8-B902-A844FDF42E85" */ public String getSessionStr() { WSClient wsc = vimService.getWsc(); return wsc.getCookie(); }
/** * Sets the timeout for server connections. * * @param timeout the timeout to be used for connecting * @return true, if the operation was successful */ public boolean setTimeout(int timeout) { if (m_serviceInstance != null) { ServerConnection serverConnection = m_serviceInstance.getServerConnection(); if (serverConnection != null) { VimPortType vimService = serverConnection.getVimService(); if (vimService != null) { Client client = vimService.getWsc(); if (client != null) { client.setConnectTimeout(timeout); client.setReadTimeout(timeout); m_timeout = timeout; logger.debug("Set VMware service instance timeout to " + timeout + " ms."); return true; } } } } return false; }
/** * Sets the timeout for server connections. * * @param timeout the timeout to be used for connecting * @return true, if the operation was successful */ public boolean setTimeout(int timeout) { if (m_serviceInstance != null) { ServerConnection serverConnection = m_serviceInstance.getServerConnection(); if (serverConnection != null) { VimPortType vimService = serverConnection.getVimService(); if (vimService != null) { Client client = vimService.getWsc(); if (client != null) { client.setConnectTimeout(timeout); client.setReadTimeout(timeout); m_timeout = timeout; logger.debug("Set VMware service instance timeout to " + timeout + " ms."); return true; } } } } return false; }
String cookieValue = vimPort.getWsc().getCookie(); StringTokenizer tokenizer = new StringTokenizer(cookieValue, ";"); cookieValue = tokenizer.nextToken();
public ServiceInstance(URL url, String username, String password, boolean ignoreCert, String namespace) throws RemoteException, MalformedURLException { if(url == null || username==null) { throw new NullPointerException("None of url, username can be null."); } setMOR(SERVICE_INSTANCE_MOR); VimPortType vimService = new VimPortType(url.toString(), ignoreCert); vimService.getWsc().setVimNameSpace(namespace); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); vimService.getWsc().setSoapActionOnApiVersion(serviceContent.getAbout().getApiVersion()); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); //with new SOAP_ACTION setServerConnection(new ServerConnection(url, vimService, this)); UserSession userSession = getSessionManager().login(username, password, null); getServerConnection().setUserSession(userSession); }
public ServiceInstance(URL url, String sessionStr, boolean ignoreCert, String namespace) throws RemoteException, MalformedURLException { if(url == null || sessionStr ==null) { throw new NullPointerException("None of url, session string can be null."); } setMOR(SERVICE_INSTANCE_MOR); VimPortType vimService = new VimPortType(url.toString(), ignoreCert); WSClient wsc = vimService.getWsc(); wsc.setCookie(sessionStr); wsc.setVimNameSpace(namespace); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); wsc.setSoapActionOnApiVersion(serviceContent.getAbout().getApiVersion()); setServerConnection(new ServerConnection(url, vimService, this)); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); //with new SOAP_ACTION UserSession userSession = (UserSession) getSessionManager().getCurrentProperty("currentSession"); getServerConnection().setUserSession(userSession); }
System.out.println("File Name: " + diskFileName); System.out.println("VMDK URL: " + diskUrlStr); String cookie = si.getServerConnection().getVimService().getWsc().getCookie(); long lengthOfDiskFile = writeVMDKFile(diskLocalPath, diskUrlStr, cookie, alredyWrittenBytes, diskCapacityInByte); alredyWrittenBytes += lengthOfDiskFile;
System.out.println("File Name: " + diskFileName); System.out.println("VMDK URL: " + diskUrlStr); String cookie = si.getServerConnection().getVimService().getWsc().getCookie(); long lengthOfDiskFile = writeVMDKFile(diskLocalPath, diskUrlStr, cookie, alredyWrittenBytes, diskCapacityInByte); alredyWrittenBytes += lengthOfDiskFile;