Hello. We are trying to create a custom solution to launch VMs for our own homegrown Hands on Labs project. We would like to display a page with available labs and that once clicked on, will launch a VM inside a browser window.
We have got things working with our old approach but we have to utilize ActiveX with a RDP client on the webpage but this is of course limited to just the Internet Explorer browser. We are trying to use the new HTML Console SDK to open this up to multiple browsers.
We have been trying to create a new solution using the VMware HTML Console SDK with this documentation: https://www.vmware.com/support/developer/html-console/html-console-sdk-100-programmer-guide.pdf
Current Environment:
VMware vCloud Director: 5.5.5.3153714
We are trying to construct the WebSocket URL so we can run the wmks.Connect method. Can anyone explain this part of the documentation from page 6: “<ws | wss> :// <host:port>/ <path> /? <authentication info>” Where do the parts come from to build this URL? Our main issue right now is to first get the connection setup.
If you have any further insight into how this needs to be setup at the most basic level, or have any further documentation/examples that can help us out, it would be greatly appreciated.
webconsole.html is the web page for displaying VM Web Console by vSphere Web Client. The javascript in webconsole.html will use "wss://vcenter_server_ip:9443/vsphere-client/webconsole/authd?..." to connect to vCenter Server.
What error you got in the web browser when connecting "wss://.../authd?..." ?
link created:
wss://192.168.3.128:9443/vsphere-client/webconsole/authd?vmId=vm-205&vmName=zs999&host=vcenter.yunhorn.com&sessionTicket=cst-VCT-5241dab7-1e0e-845f-be81-3d83f5a8b5a4--tp-AF-B5-66-D0-BA-4A-CF-A9-8E-73-50-8B-B1-62-D4-8D-7A-BD-0E-B8&thumbprint=AF:B5:66:D0:BA:4A:CF:A9:8E:73:50:8B:B1:62:D4:8D:7A:BD:0E:B8
console error info:
failed: WebSocket opening handshake was canceled
ps:
telnet 192.168.3.128 9443 is fine
juanfont, any chance you could give us some sample code for generating your URL? I can get a ticket fine and I have all other details A-Okay, but there's a lot of conflicting information in this thread and the documentation is pretty vague about what to do. You seem to know what you're doing, so any information you could provide would be a big help.
Cheers in advance.
The code should be like this:
var url = "wss://192.168.3.128:9443/vsphere-client/webconsole/authd?vmId=vm-205&vmName=zs999&host=192.168.3.128&sessionTicket=cst-VCT-5241dab7-1e0e-845f-be81-3d83f5a8b5a4--tp-AF-B5-66-D0-BA-4A-CF-A9-8E-73-50-8B-B1-62-D4-8D-7A-BD-0E-B8"; var wmks = WMKS.createWMKS("wmksContainer", {}).register( WMKS.CONST.Events.CONNECTION_STATE_CHANGE, function(event,data){ if(data.state == WMKS.CONST.ConnectionState.CONNECTED) { console.log("connection state change : connected"); } }); wmks.connect(url);
Note:
1) The value of sessionTicket can be acquired by visiting "https://192.168.3.128/mob/?moid=SessionManager&method=acquireCloneTicket"
2) Make sure before opening the html page containing the javascript code above, use your web browser to visit "https://192.168.3.128:9443/vsphere-client/" once and accept the SSL certificate (no need to login vSphere Web Client).
url:
wss://192.168.3.128:9443/vsphere-client/webconsole/authd/?vmId=vm-312&vmName=tableTest&host=192.168.3.128&sessionTicket=cst-VCT-52f9d70d-52ec-f4ab-47ba-cf8c2db9f2e0--tp-AF-B5-66-D0-BA-4A-CF-A9-8E-73-50-8B-B1-62-D4-8D-7A-BD-0E-B8
console output:
failed: Error during WebSocket handshake: Unexpected response code: 500
anyway,thank you for you replay.
@zhongshun do not use '&' in the url.
OK so now we have the certificate installed correctly on the server. We have SSL configured.
I am now getting these errors:
and
Can you explain what port I should be using and what the differences are? Not sure what we are missing at this point. Thanks for the help.
Not sure if you're still experiencing issues, but I've recently embarked upon the HTML5 console journey and happened across this thread. From your first image, it looks like you're using the wrong type of ticket in the URL, but then in your second image, it looks like you have the correct ticket, but you should try including the port with the host, like:
wss://srv-sdesx2.onbase.net:443/ticket/{ticket_string}
Actually, the AcquireTicket page should tell you what port to use.
The problem I'm having with all of this is that the wmks approach only seems to work with ESXhost IPs, and I am trying to expose the console to external parties, so ESXhost IPs are pointless. I investigated another method, whereby I emulate the URL that vSphere Web Client generates for the built-in web console, which are in the format:
https://{host}:9443/vsphere-client/webconsole.html?vmId={vm_moId}&vmName={vm_name}&serverGuid={server_guid}&locale=en_US&host={host}:443&sessionTicket={AcquireCloneTicket_output}&thumbprint={ssl_thumbprint_from_sessionTicket}
However, as of vSphere 6.0, it seems that the Single Sign On (SSO) page is forced in between, so while I am able to craft the URL perfectly, once you click on the link the SSO page jumps in front and you must login to get to the web console.
If anyone knows of another approach, I'd be much appreciated.
Hi sleeyuen,
Since we started testing with vSphere 6 we ran into the exact same problem. Your approach works perfectly in vSphere 5.5, but fails in vSphere 6, redirecting to the SSO-Page.
Have you found a solution yet? Or a workaround of some kind?
Regards,
Stephan