netix_evg
Contributor
Contributor

c - gSOAP : Getting VM list using RetrieveProperties method not working ??

Hi,

I am making a small utility using C and gSOAP to list down all virtual machines information (associated with particular ESX server).

I am using RetrieveProperties method to list all VMs .... but each time getting RetrievePropertiesResponse.returnval = NULL.

Following is the C code snip :

..............................................................................................................................................................................................

struct ns2__PropertySpec propspec;

struct ns2__ObjectSpec objspec;

struct ns2__PropertyFilterSpec filtspec;

struct ns2_RetrieveProperties retprop;

struct ns2_RetrievePropertiesResponse retpropres;

struct ns2__ObjectContent *objcont;

propspec.dynamicType = NULL;

propspec.__sizedynamicProperty = 0;

propspec.dynamicProperty = NULL;

propspec.type = "VirtualMachine";

propspec.all = xsd__boolean__false_;

propspec.__sizepathSet = 1;

propspec.pathSet = (char **)malloc(sizeof(char *));

propspec.pathSet[0] = "vm";

objspec. dynamicType = NULL;

objspec.__sizedynamicProperty = 0;

objspec.dynamicProperty = NULL;

objspec.obj = mor; /* mor = serviceContent->rootFolder */

objspec.skip = xsd__boolean__false_;

objspec.__sizeselectSet = 0;

objspec.selectSet = NULL;

filtspec.dynamicType = NULL;

filtspec.__sizedynamicProperty = 0;

filtspec.dynamicProperty = NULL;

filtspec.__sizepropSet = 1;

filtspec.propSet = &propspec;

filtspec.__sizeobjectSet = 1;

filtspec.objectSet = &objspec;

retprop._USCOREthis = sc->propertyCollector;

retprop.__sizespecSet = 1;

retprop.specSet = &filtspec;

if( soap_call___ns2__RetrieveProperties(soap, EndPoint, NULL, &retprop, &retpropres ) == SOAP_OK)

fprintf(stderr, "[INFO] RetrieveProperties success\n");

else

soap_print_fault(soap, stderr);

if( !retpropres.returnval )

{

fprintf(stderr," ****** Object not found ********\n");

exit -1;

}

..............................................................................................................................................................................................

Could anyone tell me what's wrong with the above code ??

Initailly I was trying to retrieve "Datacenter" object using RetrieveProperties method but getting same result ..... RetrievePropertiesResponse.returnval = NULL

Any body having the C code to find the list of VMs running on the Particular ESX ??

0 Kudos
0 Replies