views:

69

answers:

1

As the question states - I want to send a binary file to a webservice. Does it make sense to think of this in a REST kind of way? Does it make sense to "POST" binary data, and how would you set up the receiving web service?

I am working in grails, and I am trying to set up a service that will allow one web service to pass it a file, and then pass the file back after some processing.

A: 

Yes, this is a perfectly valid scenario. Just set the request content-type to application/octet-stream and the server can read the stream of bytes and do whatever it wants with it.

Darrel Miller
How does this work on the grails side of things? Can I simply set up the closure and use the params field to pull the byte array out of it?
Derek
Sorry, that's out of my field of expertise. But if Grails can't handle it, find a new REST framework :-)
Darrel Miller
Yah - it probably can, I am just searching for examples. All of the online examples I have found they are POSTing XML data which is easy to get in grails
Derek
Look at JAX-RS plugin for Grails. This one can do anything you want :)
Matthias Hryniszak