this is what I did and this is what you can do for the producer
> def boas = callservicetogenerateReport // this should return an
> byteArray
> // setting the content type
> response.setContentType("application/pdf");
> response.setHeader("Content-Disposition", "attachment;filename=sample.pdf")
> response.setContentLength(boas.size());
> // write ByteArrayOutputStream to the ServletOutputStream
> response.outputStream << boas.toByteArray()
> response.outputStream.flush()
> response.outputStream.close()
For Consumer this is what i did in a rest call which actually handles a user submitting a file via post.
request.multiFileMap."files[]".each {file ->
def newFile = new Expando(name: file.originalFilename, size: file.size)
callServicetoAddFileToDB(file)
}
Hope this helps