RESTEasy & JAXB: "BadRequestException: Could not find message body for type ..."
Issue
- I have a JAXB-annotated class as a resource.
-
We're getting an error about not being able to find the appropriate message body reader
org.jboss.resteasy.spi.BadRequestException: Could not find message body reader for type: class com.mstr.outbound.CallItem of content type: application/xml at org.jboss.resteasy.core.MessageBodyParameterInjector$1.createReaderNotFound(MessageBodyParameterInjector.java:73) at org.jboss.resteasy.core.messagebody.ReaderUtility.doRead(ReaderUtility.java:105) at org.jboss.resteasy.core.messagebody.ReaderUtility.doRead(ReaderUtility.java:93) at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector
-
We have a POST method wheren we want the body to be an xml representation of a single argument.
@POST @Path("{subId}/{siteId}/immediate") @Produces("application/xml") @Consumes("application/xml") public ExampleResource resourceCall(CallItem callItem, @HeaderParam(value = "X-forwarded-for") String remoteIP, @QueryParam("apiKey") String token, @PathParam("siteId") String siteId) throws RemoteException, ValidationException {
Environment
- JBoss Enterprise Application Platform (EAP) 5.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.