After a vApp is powered on, you can retrieve a screen ticket from any of its virtual machines. You use that ticket with the VMware HTML Console SDK to access the virtual machine console from a browser.

Each Vm element in a vApp includes a link where rel="screen:acquireMksTicket" if the virtual machine it represents is powered on. You can use that link to retrieve a screen ticket that includes all the information you need to create a VMware HTML Console to access the virtual machine.

Note

A Vm element might also contain a link of the form:

<Link
   rel="screen:acquireTicket"
   href="https://vcloud.example.com/api/vApp/vm-4/screen/action/acquireTicket" />

This link is provided for compatibility with older systems. The ticket returned by a request to this link is not compatible with this release of vCloud Director.

This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.

Verify that the virtual machine whose console you want to display is powered on.

Download and unzip the VMware HTML Console SDK version 2.1 or later.

1

Retrieve the screen ticket.

POST a request to the acquireMksTicket link of the Vm.

Request:

POST https://vcloud.example.com/api/vApp/vm-4/screen/action/acquireMksTicket

Response:

200 OK
Content-Type: application/vnd.vmware.vcloud.mksticket+xml
...
<MksTicket
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   ... >
   <Host>10.150.130.63</Host>
   <Vmx>vmfs/volumes/5331e00b-467faf9c-5561-d48564677c70/example-vm (19115346-c01c-4c9b-a21f-d487865a9f98)/example-vm
       (19115346-c01c-4c9b-a21f-d487865a9f98).vmx</Vmx>
   <Ticket>ticket-string</Ticket>
   <Port>902</Port>
</MksTicket>

2

Construct an HTML Script element from the information in the MksTicket response.

See Example: Using an MksTicket in a VMware HTML Console SDK Script.

3

Use the Script element with the VMware HTML Console SDK .

Replace the final script element in the Quick Start example shown in the VMware HTML Console SDK Release Notes (release number 2.1, build number 4504321) with the script you constructed. Replace the ticket-string with one from a freshly-retrieved MksTicket, then open the example in a browser.

This HTML fragment shows a Script element derived from an example in the VMware HTML Console SDK Release Notes. In this example:

The contents of the Vmx element in the MksTicket is quoted and passed as the first parameter to the as SDK createWMKS method. You must also pass the boolean option enableUint8Utf8 to this method specifying a value of true.

The URL passed as a parameter to the SDK wmks.connect method includes the following information from the MksTicket.

console-ip-address is the IP address of the virtual machine, returned in the Host element of the MksTicket.

console-port is the vCloud Director console proxy port (defaults to 443).

Mks-port is the value returned in the Port element of the MksTicket

ticket is the string returned in the Ticket element of the MksTicket. The ticket-string is valid for 30 seconds from the time you retrieve the MksTicket.

<script>
var wmks = WMKS.createWMKS("wmksContainer",{VCDProxyHandshakeVmxPath:
        "vmfs/volumes/5331e00b-467faf9c-5561-d48564677c70/example-vm (19115346-c01c-4c9b-a21f-d487865a9f98)/example-vm
       (19115346-c01c-4c9b-a21f-d487865a9f98).vmx.vmx", enableUint8Utf8:true})
 .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("wss://10.150.130.63:443/902;ticket-string");
</script>