Hi,
I need to take an incoming file and send it to a third party. For
memory purposes, I'm dealing with InputStreams on the fly. I've copied
the code essentially from the jaxrs Multipart page on the CXF website,
from the section uploading files....
WebClient client = WebClient.create(<endpoint removed>)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.MULTIPART_FORM_DATA_TYPE);
ContentDisposition cd= new ContentDisposition("form-data; name=\"file\";
filename=\""+consult.getFilename()+"\"");
Attachment att = new Attachment("file", new ByteArrayInputStream(file),
cd);
MultipartBody body = new MultipartBody(att);
String resp = client.post(body, String.class);
However, when I run this code, I get:
No message body writer found for class : class
org.apache.cxf.jaxrs.ext.multipart.MultipartBody
Am I using the wrong class or did I not configure something correctly?
Any help would be greatly appreciated.
Something is interfering, the above code looks fine - I updated one of
the existing tests (client part only) and did not get this exception.
I can see the Message.properties resource 'losing' a content-type value
which was passed to it during the exception handling, needs to be fixed,
but I think something else is interefing.
By the way, default JSONProvider does not handle Strings...
If you can get CXF source and put a breakpoint in
MulipartProvider.isWriteable then it would provide an answer -
alternatively please create a test project and attach it to JIRA...
Cheers, Sergey
Thanks!
Jeff Wang