This example is based on the in the LookupServiceHelper.java sample file. The file is located in the following vCloud Suite SDK for Java directory: client/samples/java/com/vmware/vcloud/suite/samples/common/

This example uses the steps that are described in the Retrieve a vCenter Server ID by Using the Lookup Service procedure.

  ...
  
  getMgmtNodeId(String targetNodeName)
  {
    // 1 - List the vCenter Server instances.
    List<LookupServiceRegistrationInfo> serviceInfos = 
            lookupServiceUrls(“com.vmware.cis”,
                              “vcenterserver”,
                              “vmomi”,
                              “com.vmware.vim”);
   
   // 2 - Find the matching node name and save the ID.
    for (LookupServiceRegistrationInfo serviceInfo : serviceInfos) {
      for (LookupServiceRegistrationAttribute serviceAtttr : serviceInfo.getServiceAttributes()) {
        if (“com.vmware.vim.vcenter.instanceName”.equals(serviceAttr.getKey())) {
          if (serviceAttr.getValue().equals(targetNodeName)) {
            return serviceInfo.getNodeId();
          } 
        }
      }
    }
  }

  ...