Hi Stuart, Yes apologies if I wasn't clear.
On the app engine side of things I'm calling createUploadURL and placing the resulting url in the task payload as follows: BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); String uploadURL = blobstoreService.createUploadUrl("/"+url); task.payload(uploadURL); Alternatively, would anyone know of sample code in java trying to programmatically upload blobs from an external app (posting a response to a pull task queue) might make things easier. I'm surprise I couldn't find anything like that on the web. In a nutshell all I'm trying to do is reproduce the architecture of the first pull task system presented in the Google I/O talk http://youtu.be/AM0ZPO7-lcE in java, to place a response to the pull task queue for the app engine app to consume. Thanks for your help :-) On Thursday, 8 March 2012 22:13:45 UTC, Stuart Langley wrote: > > Is that the actual code? > > You need to call createUploadURL for each blob you want to upload. > > On Friday, 9 March 2012 00:03:43 UTC+11, Killian wrote: >> >> Hi Lads, >> >> This issue has been bugging me for a while now and just wasted the last 2 >> days with no solution found. I'm getting desperate at this stage ! >> >> My aim was to use the Task Queue Pull service to run some NLP processing >> outside of app engine on an external VM. That's working fine however all >> the trouble started when I discovered that the output produced by the >> external VM could be fed back into the Task Queue. Following the example in >> the Google I/O video http://youtu.be/AM0ZPO7-lcE , I then decided to >> provide the response of the task queue as a Blob upload to the app engine. >> So I have the working example >> http://code.google.com/appengine/docs/java/blobstore/overview.htmlimplement >> and working perfectly. (ie: I can manually upload a file using >> the jsp form and store it). >> >> The problem is that for obvious reasons I need to send this post request >> from the VM programmatically. And that's were things start getting messy. >> Since the video only provides an example in Python and not in java I've >> been struggling find a solution to this. >> >> Looking around it seems like I need the httpcomponents-client-4.1.3 >> apache library to create post requests. >> So this is the workflow I have: >> I generate the upload url from the app engine side and place it in the >> task queue payload which is then retrieved by the VM correctly. >> >> on the VM side this is what I do: >> >> String uploadURL = >> "http://<host>/_ah/upload/agtsaW5ndWFib3gxMHIbCxIVX19CbG9iVXBsb2FkU2Vzc2lvbl9fGAEM" >> ; >> >> DefaultHttpClient httpclient = new DefaultHttpClient(); >> >> HttpPost method = new HttpPost(uploadURL); >> >> MultipartEntity entity = new MultipartEntity(); >> >> File f = new File("dummyFileToUpload.txt"); >> >> FileBody fileBody = new FileBody(f); >> >> entity.addPart("myFile", fileBody); >> >> method.setEntity(entity); >> >> HttpResponse response = httpclient.execute(method); >> >> System.out.println(response.getStatusLine()); >> >> PROBLEM: >> >> When I do this both in development mode or production mode, I receive a >> "http 404 not found" response. and it seems like the upload servlet isn't >> run at all (if I'm in deug mode for instance). However when I look in the >> blob store, the blob was indeed uploaded correctly which is good news of >> course however it means I can't get a proper response from the app engine >> side and more importantly can't run anything in the upload servlet. >> >> I'm guessing my post request mustn't be created properly which would >> explain why the app engine side is reacting weird? Is there anything >> obviously wrong in my approach? >> >> Would really appreciate any advice on this. >> >> Thanks in advance :-) >> >> >> >> >> >> >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine-java/-/bQoB-eqC6CUJ. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.