cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Wang" <>
Subject RE: Multipart and WebClient
Date Fri, 22 Jul 2011 00:13:42 GMT
For some reason, I removed the .accept line, built, it didn't work, put
it back in, built, and it worked.  I have absolutely no idea what was
different.  There must be  ghosts in my machine...

Thanks for the help.


-----Original Message-----
From: Sergey Beryozkin [] 
Sent: Thursday, July 21, 2011 3:07 AM
Subject: Re: Multipart and WebClient


> 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)
> 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 =, 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 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

View raw message