Sending an image to an External Service Connector in Aggregate

I'm developing a connector in Aggregate 0.9.x. Things were going well until
I tried to to pass along an uploaded
image to the external service. I'm trying to access the image via it's
BlobKey, like this:

BlobKey blobkey = new BlobKey("agdmZ2gtb2RrchELEgpibG9iX3N0b3JlGOUBDA");
Image uploadedImage = ImagesServiceFactory.makeImageFromBlob(blobkey);
byte newImageData = uploadedImage.getImageData();

Using this approach, "newImageData" winds up with a null value. This looks
like a GAE issue, documented
here: http://code.google.com/p/googleappengine/issues/detail?id=4757

Once I can access the file, my plan is to send it like this:

OutputStream os = connection.getOutputStream();
os.write(newImageData, 0, newImageData.length);

Has anyone successfully sent a file through an External Service Connector?
Am I barking up the right tree?

··· -- Kevin Harvey Web Developer Vanderbilt Institute for Global Health 615-686-8238 kevin.harvey@vanderbilt.edu http://globalhealth.vanderbilt.edu

Aggregate does not use the GAE Blob storage because for the last 2
years it would not work with our use case (in fact it was only
released a year ago with a problematic api). Because nothing existed
we created our own Blob type, it's a problem when you are an early
adopter that not a lot of features are available. In fact GAE only
recently (months ago) added the API that will allows the ability to
both store and load and image programatically from code inside the web
container.

Here servlet that retrieves the image to rendered it on the webpage so
you should follow that:
http://code.google.com/p/opendatakit/source/browse/src/org/odk/aggregate/servlet/ImageViewerServlet.java?repo=aggregate

Aggregate 0.9.x code did send an image in the Insight external service
connection via JSON. If you look at the BlobSubmission that function
was called to add the blob to a json object and the data was streamed
to an external service.
http://code.google.com/p/opendatakit/source/browse/src/org/odk/aggregate/submission/type/BlobSubmissionType.java?repo=aggregate

Just as a reminder that we will soon sunset any support for 0.9.x
hopefully in september depending on the upcoming joint release of the
new tool set.

··· On Wed, Aug 3, 2011 at 5:01 AM, Kevin Harvey wrote: > I'm developing a connector in Aggregate 0.9.x. Things were going well until > I tried to to pass along an uploaded > image to the external service. I'm trying to access the image via it's > BlobKey, like this: > > BlobKey blobkey = new BlobKey("agdmZ2gtb2RrchELEgpibG9iX3N0b3JlGOUBDA"); > Image uploadedImage = ImagesServiceFactory.makeImageFromBlob(blobkey); > byte[] newImageData = uploadedImage.getImageData(); > > Using this approach, "newImageData" winds up with a null value. This looks > like a GAE issue, documented > here: http://code.google.com/p/googleappengine/issues/detail?id=4757 > > Once I can access the file, my plan is to send it like this: > > OutputStream os = connection.getOutputStream(); > os.write(newImageData, 0, newImageData.length); > > Has anyone successfully sent a file through an External Service Connector? > Am I barking up the right tree? > > -- > Kevin Harvey > Web Developer > Vanderbilt Institute for Global Health > 615-686-8238 > kevin.harvey@vanderbilt.edu > http://globalhealth.vanderbilt.edu > >