Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 192300

problem getting Hostsystem properties using C /gsoap2.8

$
0
0

actually with the below code, i receive a SOAP_OK for the soap call of RetrieveProperties, but the returnval turns out to be empty, what is the problem???

i paste the xml recieved in bottom too

 

please help

 

struct vim25__ObjectContent retrieveHostSystemProperties(struct soap* soap, const char* url, struct vim25__ServiceContent* serviceContent){

  struct vim25__RetrievePropertiesRequestType propReq;

  struct _vim25__RetrievePropertiesResponse propRes;

  struct vim25__ObjectSpec objSpec;

  struct vim25__PropertySpec propSpec;

  struct vim25__ObjectContent objContent;

  struct vim25__PropertyFilterSpec propFilterSpec;

  struct vim25__DynamicProperty dynamicProperty;

 

 

  //----------start assign objSpec-----------------------------

  objSpec.dynamicType="";

  objSpec.__sizeselectSet=0;

  objSpec.skip=malloc(sizeof(enum xsd__boolean));

  objSpec.obj=serviceContent->rootFolder;

  objSpec.__sizedynamicProperty=0;

  objSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  objSpec.dynamicProperty="";

  //----------end assign objSpec-----------------------------

 

  //----------start assign propSpec-----------------------------

  propSpec.__sizepathSet=1;

  char* propName ="name";

  propSpec.pathSet=&propName;

  propSpec.all=(enum xsd__boolean*)xsd__boolean__false_;

  propSpec.type="HostSystem";

  propSpec.__sizedynamicProperty=0;

  propSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  propSpec.dynamicProperty="";

  propSpec.dynamicType="";

  //----------end assign propSpec-----------------------------

 

  //----------start assign propFilterSpec-----------------------------

  propFilterSpec.dynamicType="";

  propFilterSpec.__sizepropSet=1;

  propFilterSpec.propSet=&propSpec;

  propFilterSpec.__sizeobjectSet =1;

  propFilterSpec.objectSet=&objSpec;

  propFilterSpec.__sizedynamicProperty=0;

  propFilterSpec.dynamicProperty=malloc(sizeof(struct vim25__DynamicProperty));

  propFilterSpec.dynamicProperty="";

  //----------end assign propFilterSpec-----------------------------

 

 

 

  //----------finish assign all Spec, pack the request-----------

 

  propReq._USCOREthis=serviceContent->propertyCollector;

  propReq.__sizespecSet=1;

  propReq.specSet=&propFilterSpec;

 

  if(soap_call___vim25__RetrieveProperties(soap, url,"", &propReq, &propRes)==SOAP_OK){

  printf("Retrieve Properties Successful: \n");

  int i;

  int j;

  for (i=0; i < propRes.__sizereturnval; i++){

  objContent = propRes.returnval[i];

  printf("Object Type: %s",objContent.obj->type);

  printf(" (%d properties)\n ",objContent.__sizepropSet);

  for (j=0; j < objContent.__sizepropSet; j++){

  dynamicProperty = objContent.propSet[j];

 

  if ( dynamicProperty.name == "name" ){

  _XML name = dynamicProperty.val;

  printf( " Name: %s\n", name);

  }

           

            }

          

        }     

 

  return propRes.returnval[0];

  }

  else{

  printf("Retrieve Properties fail\n");

  soap_print_fault(soap,stderr);

  exit(1);

  }

}

 

 

HTTP/1.1 200 OK

Date: Wed, 26 Jun 2013 09:49:58 GMT

Cache-Control: no-cache

Connection: Keep-Alive

Content-Type: text/xml; charset=utf-8

Content-Length: 402

 

 

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<RetrievePropertiesResponse xmlns="urn:vim25"></RetrievePropertiesResponse>

</soapenv:Body>

</soapenv:Envelope>


Viewing all articles
Browse latest Browse all 192300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>