Quantcast
Viewing all articles
Browse latest Browse all 2218

What API's do I use to get the objects in the VCServer inventory tree?

Hi,

 

I am creating the inventory tree view (VCServer=>Datacenter=>Folder=>Cluster) inside a standalone dialog in my plugin. The view is ready and it operates on a string XML that represents the tree hierarchy of objects (tested it with mock data). Now I need real vSphere objects to show up in my tree view and I was wondering what API's I should look at to get this going. I found this really convenient utility class that I think would help me achieve what I want

 

ServiceUtil (VMware vSphere Web Services SDK Java Samples Documentation)

 

and here is a great example which does things the way I want (Finding Morefs in the inventory tree by type)=> http://vlab-vwa.googlecode.com/svn/trunk/backend/apputils/vim25/VMUtils.java

 

Here is something that I tried that did not work

 

/////////////////////////////////////////////////////////////////

//UserSessionService service;

UserSession uSession = service.getUserSession();

ServerInfo[] info = uSession.serversInfo;

String sessionCookie = info[0].sessionCookie;

ServiceUtil util = new ServiceUtil();

util.clientLoadSession(sessionCookie);

ManagedObjectReference ref = util.getDecendentMoRef(null, "Cluster", "C-2");

/////////////////////////////////////////////////////////////////

 

The thing that I am not understanding is how do I create an "authenticated" version of ServiceUtil that will help me call the methods getDescendentMoref() and similar calls. I have a reference to a UserSessionService and VimObjectReferenceService (authenticated) and I was wondering if I can extract an instance of a ServiceUtil that I can put to use.

 

Thank you

Regards


Viewing all articles
Browse latest Browse all 2218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>