I want to do something as simple as this, send a file to the webservice, and return it's name.
@Path("/processimage")
public class ProcessImageResource {
@POST
@Consumes("image/jpg")
@Produces("text/plain")
public String processImage(File image) {
return image.getName();
}
}
Attempting to test this, using something like this...
public void testProcessImage() {
WebResource r;
File bob = new File("lena.jpg");
String responseMsg = r.path("processimage").type(MediaType.something_here).post(String.class, bob);
assertEquals("lena.jpg", responseMsg);
}
Would it be better to do this with a GET?
Most
of the Post examples I have seen show them sending in multipart form
parameters. I only want to send in one parameter, so what should I use
for mediatype?
Thanks for any help at all.
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5