static void getImage(struct soap *soap, char *name)
{ ns__Data image;
  arrayOfName temp;
  temp.resize(1);
  temp[0] = name;
  soap->user = (void*)temp.__ptr;
  if (soap_call_ns__getImage(soap, endpoint, NULL, name, image))
    soap_print_fault(soap, stderr);
  else if (image.id)
  { if (image.__size)
      printf("Got image %s size=%d type=%s through streaming DIME\n", name, image.__size, image.type?image.type:"");
    else
      printf("Got image %s type=%s through chunked streaming DIME\n", name, image.type?image.type:"");
  }
  else
  { printf("Got image %s\n", name);
    saveData(image, name);
  }
}
Example #2
0
static int getImage(const char *name, const char *url, const char *outputfile) {
	struct soap soap;
	xsd__base64Binary image;
	soap_init(&soap);
    soap.user = (void*)outputfile;
    soap.fdimewriteopen = dime_write_open;
    soap.fdimewriteclose = dime_write_close;
    soap.fdimewrite = dime_write;
	soap.connect_timeout = 10;
	int nRet = soap_call_ns__getImage(&soap, url, "", (char *)name, image);
	if (nRet != SOAP_OK) {
		soap_print_fault(&soap, stderr);
	} else {
		printf("got an image, I suppose\n");
	}
	soap_destroy(&soap);
	soap_end(&soap);
	return nRet;
}