code: public ManagedEntity searchManagedEntity(String type, String name) throws InvalidProperty, RuntimeFault, RemoteException {
          if (name == null || name.length() == 0) {
              return null;
          }
  
          if (type == null) {
              type = "ManagedEntity";
          }
  
          String[][] typeinfo = new String[][]{new String[]{type, "name",},};
  
          ObjectContent[] ocs = retrieveObjectContents(typeinfo, true);
  
          if (ocs == null || ocs.length == 0) {
              return null;
          }
  
          for (int i = 0; i < ocs.length; i++) {
              DynamicProperty[] propSet = ocs[i].getPropSet();
  
              if (propSet.length > 0) {
                  String nameInPropSet = (String) propSet[0].getVal();
                  if (name.equalsIgnoreCase(nameInPropSet)) {
                      ManagedObjectReference mor = ocs[i].getObj();
                      return MorUtil.createExactManagedEntity(rootEntity.getServerConnection(), mor);
                  }
              }
          }
          return null;
      }
docs: Get the ManagedObjectReference for an item under the
  specified parent node that has the type and name specified.
  
  @param type type of the managed object
  @param name name to match
  @return First ManagedEntity object of the type / name pair found
  @throws RemoteException
  @throws RuntimeFault
  @throws InvalidProperty