You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "adam.galloway" <ad...@scala.com> on 2009/02/24 20:03:36 UTC
JAX-RS response for POST and PUT no longer working
I have a JAX-RS service with create and update methods that return data
objects rather than a JAX-RS Response object.
I am using the 2.2-SNAPSHOT and as of recently I get an error from my POST
and PUT methods
@Path("my-service")
public class MyService {
@WebMethod
@POST
@Path("/detail/")
@Consumes("application/json")
public Detail createDetail(Detail object) {
//create detail
return newDetail;
}
@WebMethod
@GET
@Path("/detail/{id}")
public Detail getDetail(@WebParam(name = "id") @PathParam("id") Long id) {
//find detail
return someDetail;
}
}
The getDetail() method returns the object formatted in json or xml with no
problem
The createDetail() method returns the following error:
.No message body writer found for response class : Detail.
Is it likely that something in the SNAPSHOT was recently broken?
--
View this message in context: http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working-tp22188279p22188279.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: JAX-RS response for POST and PUT no longer working
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Adam
I agree it's misleading - it's an error during the deserialization which causes the problem...
So it's another issue which we need to sort out asap before 2.2 release...
Thanks, Sergey
>
> Thanks for your quick reply. It looks like I found the issue, if the
> incoming Json data is missing the root element ( {id:1} rather than {detail:
> {id: 1}} etc.) then it throws that error about not finding a message body
> writer. If the root element is there then it works fine.
>
> It's kind of a strange message for an input error, but thanks for you help.
> Playing with the request headers is what helped me find the poorly formatted
> JSON.
>
> Thanks again,
>
> Adam
>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>> I hope not... We do have few tests which post and expect the response
>> back, with the same type involved.
>>
>> Can you please provide few more details.
>> What are ContentType and Accept values ?
>>
>> Thanks, Sergey
>>
>> -----Original Message-----
>> From: adam.galloway [mailto:adam.galloway@scala.com]
>> Sent: 24 February 2009 19:04
>> To: users@cxf.apache.org
>> Subject: JAX-RS response for POST and PUT no longer working
>>
>>
>> I have a JAX-RS service with create and update methods that return data
>> objects rather than a JAX-RS Response object.
>>
>> I am using the 2.2-SNAPSHOT and as of recently I get an error from my
>> POST
>> and PUT methods
>>
>> @Path("my-service")
>> public class MyService {
>>
>> @WebMethod
>> @POST
>> @Path("/detail/")
>> @Consumes("application/json")
>> public Detail createDetail(Detail object) {
>> //create detail
>> return newDetail;
>> }
>>
>> @WebMethod
>> @GET
>> @Path("/detail/{id}")
>> public Detail getDetail(@WebParam(name = "id") @PathParam("id") Long id)
>> {
>> //find detail
>> return someDetail;
>> }
>>
>> }
>>
>> The getDetail() method returns the object formatted in json or xml with
>> no
>> problem
>>
>> The createDetail() method returns the following error:
>> .No message body writer found for response class : Detail.
>>
>> Is it likely that something in the SNAPSHOT was recently broken?
>> --
>> View this message in context:
>> http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working
>> -tp22188279p22188279.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working-tp22188279p22190574.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
RE: JAX-RS response for POST and PUT no longer working
Posted by "adam.galloway" <ad...@scala.com>.
Thanks for your quick reply. It looks like I found the issue, if the
incoming Json data is missing the root element ( {id:1} rather than {detail:
{id: 1}} etc.) then it throws that error about not finding a message body
writer. If the root element is there then it works fine.
It's kind of a strange message for an input error, but thanks for you help.
Playing with the request headers is what helped me find the poorly formatted
JSON.
Thanks again,
Adam
Sergey Beryozkin-2 wrote:
>
> Hi
>
> I hope not... We do have few tests which post and expect the response
> back, with the same type involved.
>
> Can you please provide few more details.
> What are ContentType and Accept values ?
>
> Thanks, Sergey
>
> -----Original Message-----
> From: adam.galloway [mailto:adam.galloway@scala.com]
> Sent: 24 February 2009 19:04
> To: users@cxf.apache.org
> Subject: JAX-RS response for POST and PUT no longer working
>
>
> I have a JAX-RS service with create and update methods that return data
> objects rather than a JAX-RS Response object.
>
> I am using the 2.2-SNAPSHOT and as of recently I get an error from my
> POST
> and PUT methods
>
> @Path("my-service")
> public class MyService {
>
> @WebMethod
> @POST
> @Path("/detail/")
> @Consumes("application/json")
> public Detail createDetail(Detail object) {
> //create detail
> return newDetail;
> }
>
> @WebMethod
> @GET
> @Path("/detail/{id}")
> public Detail getDetail(@WebParam(name = "id") @PathParam("id") Long id)
> {
> //find detail
> return someDetail;
> }
>
> }
>
> The getDetail() method returns the object formatted in json or xml with
> no
> problem
>
> The createDetail() method returns the following error:
> .No message body writer found for response class : Detail.
>
> Is it likely that something in the SNAPSHOT was recently broken?
> --
> View this message in context:
> http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working
> -tp22188279p22188279.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
>
--
View this message in context: http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working-tp22188279p22190574.html
Sent from the cxf-user mailing list archive at Nabble.com.
RE: JAX-RS response for POST and PUT no longer working
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi
I hope not... We do have few tests which post and expect the response
back, with the same type involved.
Can you please provide few more details.
What are ContentType and Accept values ?
Thanks, Sergey
-----Original Message-----
From: adam.galloway [mailto:adam.galloway@scala.com]
Sent: 24 February 2009 19:04
To: users@cxf.apache.org
Subject: JAX-RS response for POST and PUT no longer working
I have a JAX-RS service with create and update methods that return data
objects rather than a JAX-RS Response object.
I am using the 2.2-SNAPSHOT and as of recently I get an error from my
POST
and PUT methods
@Path("my-service")
public class MyService {
@WebMethod
@POST
@Path("/detail/")
@Consumes("application/json")
public Detail createDetail(Detail object) {
//create detail
return newDetail;
}
@WebMethod
@GET
@Path("/detail/{id}")
public Detail getDetail(@WebParam(name = "id") @PathParam("id") Long id)
{
//find detail
return someDetail;
}
}
The getDetail() method returns the object formatted in json or xml with
no
problem
The createDetail() method returns the following error:
.No message body writer found for response class : Detail.
Is it likely that something in the SNAPSHOT was recently broken?
--
View this message in context:
http://www.nabble.com/JAX-RS-response-for-POST-and-PUT-no-longer-working
-tp22188279p22188279.html
Sent from the cxf-user mailing list archive at Nabble.com.