VMware {code} Community
admin
Immortal
Immortal

how to connect CIM-XML over http

Hi there,

i try to connect the CIM interface of my ESXi hosts. There is a acquireCimServicesTicket() method but i don´t know how to initiate a connection... Could anybody help?

Here is my code:

var ticket = HostSystem.acquireCimServicesTicket();
System.log("ticket: " + ticket);
System.log("host: " + ticket.host);
System.log("port: " + ticket.port);
System.log("version: " + ticket.serviceVersion);
System.log("id: " + ticket.sessionId);
System.log("service: " + ticket.service);

var namespace = "root/interop";
var port = 5988;
var user = ticket.sessionId;
var pass = ticket.sessionId;
var content = "CIM_RegisteredProfile";

var MyURL = new URL("http://192.168.220.10:"+port+"/sdk/"+namespace);
MyURL.requestType = "POST";
MyURL.getContent();
var Result = MyURL.result;
System.log(Result);

Reply
0 Kudos
1 Reply
mmarinov
VMware Employee
VMware Employee

Hi Christian,

I'm not experienced in the CIM but I dig a little and found some interesting articles.

In general I'm not sure the URL could be the right approach. You could try the WBEMClientFactory instead. The javax.wbem has a lot of tools to work exactly with CIM instances.

If you go this way, the client need to be initialized with the VcHostServiceTicket.sessionId as user and password.

I have found several articles posted within VMware's blogs about hardware monitoring via CIM. They all uses wbem implementations. Unfortunately the samples are in Pyton.

http://blogs.vmware.com/esxi/2010/04/hardware-health-monitoring-via-cim.html (above the title you will see links to the next part of this topic).

Sorry, for not being able to direct answer your question but hope the above links will help.

Regards,

--Martin

Martin Marinov VMware Software Engineer If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points