Wednesday, 15 March 2017

VMWARE: What is the correct URL to use to establish a Virtual Console using the HTML SDK?

I'm using ESXi vSphere 6.5 and have two VMs in the cluster.

I'm trying to embed a Virtual Console inside a webpage using the HTML SDK.

The problem is that the documentation is shockingly poor and incomplete, despite there being so much of it! Looks like its been put together by a bunch of monkeys. Anyway......

I came across this: https://gist.github.com/vmwaredevcenter/470a82e2ca97a329b6e6fb420788d540 which I thought provided all the info I'd need. I was wrong.

I have successfully embedded a Virtual Console by obtaining a webmks ticket using SOAP with the AcquireTicket method. That request returns a bunch of data...

<ticket>5705500be7278979</ticket>

<cfgFile>a/b/c.vmx</cfgFile>

<host>the-vms-FQDN.dev.whatever</host>

<port>443</port>

<sslThumbprint>A3:4E:D6:5F:25:20:02:4F:A8:78:9A:1F:65:8B:D2:C9:AB:A1:AE</sslThumbprint>

I am able to then use the ticket portion of that response and connect to the following URL, but ONLY because I know the VM's IP address which I have to hardcode in. (None of the the other data is used)

var url = "wss://the_actual_ip_of_vm:443/ticket/5705500be7278979";

Which establishes a connection and I am able to fully interact with the VM's OS via the webpage.

HOWEVER.... note that this approach requires knowledge of the VMs IP address and a VM may not necessarily have a network address. I am also unable to get a VM's IP address (using the available APIs) even if it had one so this cannot be the correct solution right??

The other approach is to use AcquireCloneTicket method. Again, I am able to get a valid response, but this ONLY gives you the ticket string, such as: cst-VCT-5201d097-0d3f-6780-c7de-6c82396f20e5--tp-A3-4E-D6-5F-25-20-02-4F-A8-78-9A-1F-65-8B-D2-C9-AB-A1-AE.

This is where I am lost! I have no idea as to how to use this type of ticket. I've attempted to use a number of URLs based on those outlined in the link I provided above but to no avail. I continually get 500 server error.

CAN ANYONE GIVE A DEFINITIVE EXAMPLE OF HOW THE URL SHOULD BE CONSTRUCTED if you wish to connect to a VM via the vCentre host?!

Thanks in advance!

CLIENT SIDE CODE

...
    _wmks = WMKS.createWMKS("wmks-container", {
        "useVNCHandshake": false,
        "sendProperMouseWheelDeltas": true,
        "rescale": false
    });

    _wmks.connect(url);
...



via adamjeffery_dev

No comments:

Post a Comment