On Jul 9, 2009, at 5:00 PM, vaidya nathan wrote:
> This is my resource
>
> @POST
> @Path("contractinfo/search")
> @Produces("application/xml")
> public Response findMethod(Criterea)
>
> where Criterea is a user defined object duly jaxb annotated. I have
> a JAXBElementProvider as follows
>
> @Provider
> @Produces("application/xml")
> @Consumes("application/xml")
> public class JAXBElementProvider<T> implements MessageBodyReader<T>,
> MessageBodyWriter<T>{
>
> with the readFrom and writeTo properly coded (it works for 0.6 ).
> The problem i am having is as follows
>
> 1. i upgraded from 0.6 to 1.0.3 (changed lot of stuff like
> annotations,class locations,etc)
> 2. i am able to make a request to another uri
> @GET
> @Produces("text/plain")
> @Path("ping")
> public String ping() {
> return "pong";
> }
>
>
> The client that i use is a client proxy which uses the
> uribuilder(still the old way ) and with ping it goes and gets the
> pong response, but when i send a request which sends the xml (with
> criterea) i get the following error in the tomcat server logs
> SEVERE: A message body reader for Java type, class <Class> , and
> MIME media type, application/x-www-form-urlencoded, was not found
>
It looks like you client is sending a content-type of "application/x-
www-form-urlencoded" instead of "application/xml" for the POST
request. You need to set the content-type to "application/xml".
> I added the mimepull as someone suggested but to no avail. I dont
> think that it is using my provider. is there a way in which i need
> to register the provider which has changed between 0.6 and 1.0.3 ?
>
In you Tomcat server logs you should see some output stating that it
found the provider class JAXBElementProvider ? correct ?
Paul.
> How do i make the resource accept xmls ?
>
> Please help
>
> Cheers
> Restuser
>