/** * @param url The URL of the Virtual Center Server * <p>https://<Server IP / host name>/sdk * <p>The method establishes connection with the web service port on the server. This is not * to be confused with the session connection. */ private static void initVimPort(String url) { VimServiceLocator locator = new VimServiceLocator(); locator.setMaintainSession(true); try { VIM_PORT = locator.getVimPort(new URL(url)); } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (Exception se) { se.printStackTrace(); } }
public void loadSession(String url, String cookieString) throws Exception { if (_service != null) { disconnect(); } _locator = new VimServiceLocator(); _locator.setMaintainSession(true); _service = _locator.getVimPort(new URL(url)); org.apache.axis.client.Stub st = (org.apache.axis.client.Stub) _service; st._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, cookieString); _locator.setMaintainSession(true); _sic = _service.retrieveServiceContent(_svcRef); }
public void init(String urlStr, String cookieString) throws Exception { if (_service != null) { disconnect(); } _locator = new VimServiceLocator(); _locator.setMaintainSession(true); _service = _locator.getVimPort(new URL(urlStr)); _sic = _service.retrieveServiceContent(_svcRef); org.apache.axis.client.Stub st = (org.apache.axis.client.Stub) _service; org.apache.axis.client.Call callObj = st._getCall(); org.apache.axis.MessageContext msgContext = callObj.getMessageContext(); msgContext.setProperty( org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, cookieString); _svcState = ConnectionState_Connected; }
/** * Creates an instance of the VMA proxy and establishes a connection * * @param urlStr web service url * @param username authorized user * @param password authorized password for user */ public void connect(String urlStr, String username, String password, boolean ignoreCerts) throws Exception { if (_service != null) { disconnect(); } if (ignoreCerts) { ignoreCert(); } _locator = new VimServiceLocator(); _locator.setMaintainSession(true); _service = _locator.getVimPort(new URL(urlStr)); _sic = _service.retrieveServiceContent(_svcRef); if (_sic.getSessionManager() != null) { _service.login(_sic.getSessionManager(), username, password, null); // This Code Is To Save The Session In The Test File. } _svcState = ConnectionState_Connected; }