Hi Sushil,

Is the error you posted (no MessageBodyWriter) happening on the client
side?  If so, that makes sense.

On the server side, you want to use the InMulitPart.  On the client side,
you need to use the OutMultiPart.  The writer only knows how to write out
OutParts and the reader can only read and create InParts.

Hope that helps.






                                                                       
             sushil                                                    
             <[email protected].                                         
             com>                                                       To
                                       [email protected]   
             05/13/2010 12:48                                           cc
             AM                                                        
                                                                   Subject
                                       REST Client failed to upload file
             Please respond to                                         
             wink-...@incubato                                         
               r.apache.org                                            
                                                                       
                                                                       
                                                                       





I have the following handler:
{Code}
@POST
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaTypeUtils.MULTIPART_FORM_DATA)
public String uploadFiles(@Context HttpServletRequest request,
InMultiPart
inMP) {
...
}

I have created REST Client using JacksonJaxbJsonProvider.class
{Code}
protected RestClient getClient() {
                 BasicAuthSecurityHandler handler = new
BasicAuthSecurityHandler();
                 handler.setUserName(username);
                 handler.setPassword(password);
                 ClientConfig config = new ClientConfig();
                 config.handlers(handler);
                 config.applications(new Application() {
                                 @Override
                                 public Set<Class<?>> getClasses() {
                                                 HashSet<Class<?>> s = new
HashSet<Class<?>>();
                                                 s.add
(JacksonJaxbJsonProvider.class);// by default the wink
                                                 return s;
                                 }
                 });

                 return new RestClient(config);
}
But while trying to upload the file I am getting error,
{ERROR}

java.lang.RuntimeException: No javax.ws.rs.ext.MessageBodyWriter found for
type class org.apache.wink.common.model.multipart.InMultiPart and media
type
multipart/form-data

Do you have a suggestion how to resolve the issue?
--
View this message in context:
http://apache-wink-dev.3470905.n2.nabble.com/REST-Client-failed-to-upload-file-tp5044819p5044819.html

Sent from the Apache Wink Dev mailing list archive at Nabble.com.

Reply via email to