VMware {code} Community
dharmeshj
Enthusiast
Enthusiast

How to retrieve vSphere Session

Hi Folks,

I am trying to build  HTML5 plugin, for which there is a need to implement VMware "PropertyProviderAdapter" from "com.vmware.vise.data.query" package. I am trying to call an API from REST backend from the property provider adapter implemented Class.

Now in order to call the REST API, I need to pass VMware session id and "managed object reference" to the API,

my query is that is how we can get VMware session id from vSphere library or something related.

I need the plugin to work in the linked mode as well, and we are using SDK 6.5 U2 for development.

Thanks in advance Smiley Happy

0 Kudos
1 Reply
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

 

We expose a "userSessionService" to be used by plugins.

In order to get the user session, you need to get a reference to the "userSessionService" in your bundle-context-osgi.xml and simply inject it in your bean/class.

Then, you can call "userSessionService.getUserSession()" to get the current user session, including a list of "ServerInfo" objects.

You can have a look at the html sample plugin from vSphere Client SDK 6.7U1 to get a better idea.

 

Best Regards,

Denis

0 Kudos