File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes REST Web Service: 415 - Unsupported Media Type error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST Web Service: 415 - Unsupported Media Type error" Watch "REST Web Service: 415 - Unsupported Media Type error" New topic
Author

REST Web Service: 415 - Unsupported Media Type error

Loyiso Mdutshane
Greenhorn

Joined: Jan 14, 2011
Posts: 1
I am trying to build a poll web service:

1. On my client side I have transformed my java object to JAXBElement
JAXBElement<Poll> jaxbPoll = new JAXBElement<Poll>( new QName("poll"), Poll.class, poll );
ClientResponse resp = service.put( ClientResponse.class , jaxbPoll );

2. On the PollResource side, I receive a JAXBElement<Poll> parameter
public Response createPoll( JAXBElement<Poll> jaxbPoll ){}

I however receive a 415 error and the information below:

14 Jan 2011 4:48:09 PM com.sun.jersey.spi.container.ContainerRequest getEntity
SEVERE: A message body reader for Java class javax.xml.bind.JAXBElement, and Java type javax.xml.bind.JAXBElement<rest.Poll>, and MIME media type application/octet-stream was not found
14 Jan 2011 4:48:09 PM com.sun.jersey.spi.container.ContainerRequest getEntity
SEVERE: The registered message body readers compatible with the MIME media type are:
application/octet-stream ->
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.RenderedImageProvider
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
com.sun.jersey.core.impl.provider.entity.EntityHolderReader
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General

Please help me solve this problem, how do I convert my objects to a recognized MIME type?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REST Web Service: 415 - Unsupported Media Type error
 
Similar Threads
Web Service client with SOAP attachment
JMS Message to Weblogic from Tomcat
HTTP status 404 error on page
Mistakenly changed web.xml
Tomcat 7 throwing "A message body reader for... is not found"