VMware {code} Community
virat1234
Enthusiast
Enthusiast

getVcSelectorInfo() returns null in globalview-html sample

I noticed that getVcSelectorInfo() was returning null so I launched the globalview-html sample app to see what was different. The sample also returns null (see screenshot). What am I missing here?

Virat

Screen Shot 2016-10-05 at 12.25.30 PM.png

0 Kudos
8 Replies
_vladi_
VMware Employee
VMware Employee

Hi Virat,

This was a known problem in the past that was fixed with SDK 6.0.2.

In order to clarify if we have to look at it again could you please let me know the SDK version you tested? Please also try to get the latest web-platform.js from HTML Client SDK Fling or SDK 6.0.2 and copy it to the plug-in.

Thanks.

Cheers,

Vladimir

0 Kudos
virat1234
Enthusiast
Enthusiast

I downloaded the latest sdk and the globalview-html sample started working. But, in my plugin I receive just the "serverGuid" and the other two values are null. I have noticed that in the documentation you guys mention "If the view does not use an absolute https URL the sessionId and the serviceUrl are not part of the document request" and "The relative URL path must end with .html in order for the view's http session to be authenticated properly."

The url that is being used for my plugin view looks like this

https://my-desktop:9443/vsphere-client/mycompanyclient/resources/#/random-view/something?&locale=en_...

I am some questions on this.

  1. What should I be doing here to get the serviceUrl and sessionId?
  2. I could fetch the above from the getUserSession() function by matching the serverGuid to serviceGuid.
  3. The javascript framework I am using does not use .html in its url (I am not sure why that is a requirement).
  4. The url above for my plugin's view is  HTTPS, but the framework does not give me the sessionId or serviceUrl. (I understand why it is not provided in a HTTP url)
  5. If I send the request to the java layer and try to fetch it from UserSessionService, the UserSessionService.getUserSessions() returns null.

Thanks,

Virat

0 Kudos
irahov
VMware Employee
VMware Employee

Hi, Virat,

I'm not very familiar with the flex client but here it is some input from me

1. seesionId is mapped to webClientSessionId=f3adf495-a9d6-4254-856f-39e65827c73b

2.  Yes, you can use getUserSession()

3. I'm not sure what the js framework has to do with this. Having '.html' in the url refers to the values in the 'plugin.xml', for example:

<extension id="com.vmware.samples.chassisa.SummaryView">
   <extendedPoint>com.vmware.samples.chassisa.summaryViews</extendedPoint>
   <object>
      <name>#{summary.view}</name>
      <componentClass className="com.vmware.vsphere.client.htmlbridge.HtmlView">
         <object>
            <root>
               <url>/vsphere-client/chassisa/resources/chassis-summary.html</url>
            </root>
         </object>
      </componentClass>
   </object>
</extension>

What do you mean by

I downloaded the latest sdk 

which is the one that you have downloaded?

Have tried with the HTML Client SDK Fling (https://labs.vmware.com/flings/vsphere-html5-web-client) as suggested by Vladimir? 

 

Regards,

Ivo

0 Kudos
virat1234
Enthusiast
Enthusiast

I'm not sure what the js framework has to do with this. Having '.html' in the url refers to the values in the 'plugin.xml',

URL's can end is so many ways, why do they have to end with .html? For example, my urls look like


               <url>/vsphere-client/chassisa/resources/#/chassis-summary</url>

Why is the .html at the end a requirement?

which is the one that you have downloaded?

I downloaded the lastest vsphere-client-sdk (the sdk for the flex client) and that resolved by previous issue.

Thanks,

Virat

0 Kudos
virat1234
Enthusiast
Enthusiast

*Bump*

0 Kudos
laurentsd
VMware Employee
VMware Employee

> Why is the .html at the end a requirement?

This is a requirement for HTML plugin views running in the vSphere Web Client in order to get an authenticated request for the current user.

So you can ignore that requirement if your plugin view doesn't rely on the current user authentication, i.e. the plugin doesn't fetch any vSphere data for that user.

0 Kudos
CathyBr
Enthusiast
Enthusiast

Hi Laurent,

we are also having a similar problem with WEB_PLATFORM.getVcSelectorInfo();

We now build our plug-in using the 6.5 sdk (4602587).  And we set our VSPHERE_SDK_HOME environment variable to:
..\vsphere-client-sdk-6.5.0-4602587\vsphere-client-sdk\flex-client-sdk


We have a global page which uses the vcenterSelectorInfo.
When the plug-in is registered on a vCenter 6.5 it works fine, but when
the same plug-in is registered on a vCenter 6.0U2 the session information is missing.

At the top of our view we can see the combo box containing the name of the vCenter (there is only 1 in this case..)
but when we call the following in our html page:

var info = WEB_PLATFORM.getVcSelectorInfo();

info returns:
info.serviceGuid = null
info.serviceUrl = null
info.sessionId = null

When we built the plug-in using the 6.0U2 sdk, it worked on a vCenter 6.0U2 (but I did not try it on a 6.5).

Is this problem known, or are we doing something wrong?  Should we set our VSPHERE_SDK_HOME to
..\vsphere-client-sdk-6.5.0-4602587\vsphere-client-sdk\html-client-sdk  instead?

thanks for the info
Cathy

0 Kudos
CathyBr
Enthusiast
Enthusiast

Hi I just checked again, and indeed our url does end in .html - so I don't think that is the problem.

0 Kudos