VMware Cloud Community
legioon
Enthusiast
Enthusiast

How to connect to VM Console with vCloud Director REST API ?

Hi all,

I have vCloud Director 8.20.0 and i have many vApp VM on some organizations. I am developing custom portal for VCD and  I want to connect to VM console using REST api. But, i could not be success...

What i did ??

First of all, I read example about that on "vCloud API Programming Guide for Service Providers guide VCD 8.20.0" guide as you can see the at following link.

https://pubs.vmware.com/vcd-820/topic/com.vmware.ICbase/PDF/vcloud_sp_api_guide_27_0.pdf

I downloaded VMware HTML Console SDK 2.1 and extracted zip file to folder.

pastedImage_5.png

Than, I created a new html file named console.html which has related html codes as you can see at below. ( I found html codes at the following link ;Release Notes )

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>Console</title>

</head>

<body>

<link rel="stylesheet" type="text/css" href="css/wmks-all.css" />

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>

<script type="text/javascript" src="http://code.jquery.com/ui/1.8.16/jquery-ui.min.js"></script>

<script type="text/javascript" src="wmks.min.js"></script>

<div id="wmksContainer" style="position:absolute;width:100%;height:100%"></div>

<script>

var wmks = WMKS.createWMKS("wmksContainer",{VCDProxyHandshakeVmxPath:"vmfs/volumes/5853a4db-421ca071-9edf-b05adabcdba8/VAPP01 (f3814898-b239-4ac0-9d90-2411379f23b5)/VAPP01 (f3814898-b239-4ac0-9d90-2411379f23b5).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://VCD-IP:443/902;cst-cWXrQtbJk0eKf+w2f33/4JKQNAUgcWvz4RdzMVOqPWeVLwxM7NnjewHr69x3uWi6R0TOIMyZWBbRVG2tEoW9iFfa+QTxEt1yYZ0ks2rFgsPXa7FadR82pkzQzrXUfyxnrBCdrrqsBg7eDQfgxueoj3yNiz7pnRjZRglY1j3EJrWPcVm9dql+mkXsK51CDbU42ORRHUaaOgLsFgU1ndndbHNQ4T4i0LOfb9ppSvehAnY=-G85/fcnZXX/fLCkCwZNxwr6B0RrYgjslexp33A==--tp-60:39:C9:C2:E1:27:BF:1D:3A:CD:B9:82:AB:8B:C5:F5:7C:95:ED:B6--");

</script>

</body>

</html>

I wrote related parameters ( Ticket, Host etc... ) to console.html according to VM Post Parameters ;

pastedImage_14.png

Finally, I am opening console.html file and i just see white page ! There is no console, no error or anything else.

I don't understant what is wrong.

0 Kudos
0 Replies