cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cganesan <chandru.gane...@hp.com>
Subject No message body reader has been found for request class
Date Tue, 31 Jan 2012 23:10:03 GMT
Hi

I'm trying to exectute an Http POST with following JSON in the request body:

{
   "id":  "9852654659650"
}

I expect the JSON to be mapped to the folllowing requestBean Java object to
be injected before the service method is called:

My service method is as follows:

@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Path("/test")
    public String test(RequestBean requestBean) {
        return "test";
    }

I get the error:
No message body reader has been found for request class RequestBean.

The problem is with maping the inputstream to java object.
I'm using spring configuation as follows. Do I need to configure
MessageBodyProvider? If so, could you provide some sample?

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <jaxrs:server id="myService" address="/myService">
        <jaxrs:serviceBeans>
            <ref bean="serviceImpl" />
        </jaxrs:serviceBeans>
    </jaxrs:server>

    <bean id="serviceImpl" class="services.ServiceImpl" />

Appreciate the help

Thanks
Chandru

--
View this message in context: http://cxf.547215.n5.nabble.com/No-message-body-reader-has-been-found-for-request-class-tp5445998p5445998.html
Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message