Package com.vmware.vim.vmomi.client

Examples of com.vmware.vim.vmomi.client.Client


      httpConfig.getKeyStoreConfig().setKeyAlias(CmsKeyStore.VC_EXT_KEY);
      httpConfig.getKeyStoreConfig().setKeyPassword(CmsKeyStore.getVCExtPassword());
      httpConfig.setThumbprintVerifier(getThumbprintVerifier());
      HttpClientConfiguration clientConfig = HttpClientConfiguration.Factory.newInstance();
      clientConfig.setHttpConfiguration(httpConfig);
      Client client = Client.Factory.createClient(sdkUri, version, clientConfig);
      SessionManager sm = null;
      try {
         ManagedObjectReference svcRef = new ManagedObjectReference();
         svcRef.setType("ServiceInstance");
         svcRef.setValue("ServiceInstance");
         ServiceInstance si = client.createStub(ServiceInstance.class, svcRef);
         sm = client.createStub(SessionManager.class,
               si.getContent().getSessionManager());
         sm.loginExtensionByCertificate(extKey, "en");
         String ticket = sm.acquireSessionTicket(null);
         logger.info("got session ticket using extension");
         return ticket;
View Full Code Here


         }
      };
   }

   public void authenticateUser(String name, String password) throws Exception {
      Client vmomiClient = null;
      try {

         URI uri = new URI(serviceUrl);
         HttpConfiguration httpConfig = new HttpConfigurationImpl();
         httpConfig.setThumbprintVerifier(getThumbprintVerifier());
         HttpClientConfiguration clientConfig =
               HttpClientConfiguration.Factory.newInstance();
         clientConfig.setHttpConfiguration(httpConfig);
         vmomiClient = Client.Factory.createClient(uri, version, clientConfig);

         ManagedObjectReference svcRef = new ManagedObjectReference();
         svcRef.setType("ServiceInstance");
         svcRef.setValue("ServiceInstance");

         ServiceInstance instance =
               vmomiClient.createStub(ServiceInstance.class, svcRef);
         ServiceInstanceContent instanceContent = instance.retrieveContent();
         SessionManager sessionManager =
               vmomiClient.createStub(SessionManager.class,
                     instanceContent.getSessionManager());

         sessionManager.login(name, password, sessionManager.getDefaultLocale());
         sessionManager.logout();
      } finally {
         if (vmomiClient != null) {
            vmomiClient.shutdown();
         }
      }
   }
View Full Code Here

TOP

Related Classes of com.vmware.vim.vmomi.client.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.