I have mimepull.jar in my classpath and I still face the same issue. Plz
help- it's urgent that this POC gets underway so we implement it in our
project.
Server code -
@Path("/fileTransfer")
public class FileTransferServer {
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_XML)
public String fileTransferInviteMultiPart(FormDataMultiPart data) throws
IOException {
return "success";
}
}
client code -
ClientConfig config = new DefaultClientConfig();
config.getClasses().add(MultiPartWriter.class);
Client client = Client.create(config);
client.setChunkedEncodingSize(1024*1024);
WebResource service = client.resource(getBaseURI());
File veryLargeFile = new File("D:/dummy.txt");
FormDataMultiPart formData = new FormDataMultiPart();
if (veryLargeFile != null) {
formData.bodyPart(new FormDataBodyPart("file1_metadata", "this is file
metadata", MediaType.MULTIPART_FORM_DATA_TYPE));
formData.bodyPart(new FileDataBodyPart("file1", veryLargeFile,
MediaType.APPLICATION_OCTET_STREAM_TYPE));
}
String xmlString =
service.path("rest").path("fileTransfer").type(MediaType.MULTIPART_FORM_DATA).accept(MediaType.APPLICATION_XML).post(String.class,formData);
System.out.println(xmlString);
--
View this message in context: http://jersey.576304.n2.nabble.com/SEVERE-A-message-body-reader-for-Java-class-com-sun-jersey-multipart-FormDataMultiPart-and-Java-typed-tp5969276p7328575.html
Sent from the Jersey mailing list archive at Nabble.com.