Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes Jaxrs webservice put and post methods return :  HTTP/1.1 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Jaxrs webservice put and post methods return :  HTTP/1.1 415 Unsupported Media Type  error" Watch "Jaxrs webservice put and post methods return :  HTTP/1.1 415 Unsupported Media Type  error" New topic
Author

Jaxrs webservice put and post methods return : HTTP/1.1 415 Unsupported Media Type error

I Lopes de Sarria
Greenhorn

Joined: Oct 30, 2010
Posts: 12
I have a basic CRUD webservice. The lookups (@GET methods) work but the create/edit/deletes are giving the Unsupported Media Type error ie:

SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-8080-3) Failed executing POST /Funds/create: org.jboss.resteasy.spi.UnsupportedMediaTypeException: Cannot consume content type
at org.jboss.resteasy.core.registry.Segment.match(Segment.java:117) [resteasy-jaxrs-2.3.2.Final.jar:]

I have tried different method signatures to no avail:


and the class signature for the Fund entity is:

...

Can anyone see anything obviously wrong with this?
Many thanks
I Lopes de Sarria
Greenhorn

Joined: Oct 30, 2010
Posts: 12
Resolved. In the client to test the call, i needed to add a header: Content-Type: application/xml and if receiving XML back then an additional Content-Type of "Accept"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jaxrs webservice put and post methods return : HTTP/1.1 415 Unsupported Media Type error