You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by rconline <rc...@gmail.com> on 2009/10/25 13:05:16 UTC
Re: No message body writer found for response class : ArrayList
Hi Guys,
Read all the posts on the thread. Maybe my question is stupid or maybe i
dont get the problem at all.
Here' my web service
@WebMethod
@GET
@Produces("application/json")
@Path("/summaryList/")
Collection<PublisherReport> getSummaryList(String test);
I want the method should return a list of json objects. The Object
PublisherReport contains primitive/equiv object as member variables.
Do i need to write a messagewriter as
public class ListWriter implements MessageBodyWriter<List<PublisherReport>>
{...
}
Or am i not getting the problem at all?
--
View this message in context: http://www.nabble.com/No-message-body-writer-found-for-response-class-%3A-String---tp25070046p26047209.html
Sent from the cxf-user mailing list archive at Nabble.com.
RE: No message body writer found for response class : ArrayList
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi
MessageBodyWriter should be parameterized by
Collection<PublisherReport>...
Using Collection only will work in 2.2.3/2.2.4, Benson has done some
fixes on the trunk so Collection<PublisherReport> will be the best
option going forward...
That said, it is not the first time users have to deal with writing
custom providers for primitive types be serialized in JSON...If no JAXB
involved then may be Jackson would do well, but perhaps shipping a
simple provider dealing with primitive types would help indeed...
Sergey
-----Original Message-----
From: Gabo Manuel [mailto:kmanuel@solegysystems.com]
Sent: 26 October 2009 03:46
To: users@cxf.apache.org
Subject: Re: No message body writer found for response class : ArrayList
Hi,
Just a pair of questions, is the message subject the exception message
encountered? And, is the MessageBodyWriter intentionally marked as List
while the method response is Collection? I think making it the other way
around should set it straight.
Gabo
rconline wrote:
> Hi Guys,
>
> Read all the posts on the thread. Maybe my question is stupid or maybe
i
> dont get the problem at all.
>
> Here' my web service
>
> @WebMethod
> @GET
> @Produces("application/json")
> @Path("/summaryList/")
> Collection<PublisherReport> getSummaryList(String test);
>
> I want the method should return a list of json objects. The Object
> PublisherReport contains primitive/equiv object as member variables.
>
> Do i need to write a messagewriter as
>
> public class ListWriter implements
MessageBodyWriter<List<PublisherReport>>
> {...
> }
>
> Or am i not getting the problem at all?
>
>
------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.423 / Virus Database: 270.14.32/2459 - Release Date:
10/25/09 19:57:00
>
>
Re: No message body writer found for response class : ArrayList
Posted by Gabo Manuel <km...@solegysystems.com>.
Hi,
Just a pair of questions, is the message subject the exception message
encountered? And, is the MessageBodyWriter intentionally marked as List
while the method response is Collection? I think making it the other way
around should set it straight.
Gabo
rconline wrote:
> Hi Guys,
>
> Read all the posts on the thread. Maybe my question is stupid or maybe i
> dont get the problem at all.
>
> Here' my web service
>
> @WebMethod
> @GET
> @Produces("application/json")
> @Path("/summaryList/")
> Collection<PublisherReport> getSummaryList(String test);
>
> I want the method should return a list of json objects. The Object
> PublisherReport contains primitive/equiv object as member variables.
>
> Do i need to write a messagewriter as
>
> public class ListWriter implements MessageBodyWriter<List<PublisherReport>>
> {...
> }
>
> Or am i not getting the problem at all?
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.423 / Virus Database: 270.14.32/2459 - Release Date: 10/25/09 19:57:00
>
>