You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Barry Hathaway <bh...@nycap.rr.com> on 2011/08/18 01:22:51 UTC
Returning classes with lists
I have a method that returns a class containing a couple of lists;
however, when it executes I get:
javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its
super class is known to this context.
The method is:
@WebMethod(operationName="query", action="urn:query")
public QueryResultSet query(@WebParam(name="sparcql")String sparcql)
where QueryResultSet is:
public class QueryResultSet {
private List<Object> columnNames;
private List<Object> resultSet; <- Object will actually be a
List<Object>
... getters and setters
}
How do you go about annotating the classes so the it gets marshalled
correctly?
Thanks.
Barry Hathaway
Re: Returning classes with lists
Posted by Rob Sonke <ro...@tigrou.nl>.
I would annotate the getColumnNames() and getResultSet() with
@XmlElementWrapper and annotate the QueryResultSet class with
@XmlRootElement
Rob
On Thu, Aug 18, 2011 at 1:22 AM, Barry Hathaway <bh...@nycap.rr.com>wrote:
> I have a method that returns a class containing a couple of lists; however,
> when it executes I get:
>
> javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its
> super class is known to this context.
>
> The method is:
>
> @WebMethod(operationName="**query", action="urn:query")
> public QueryResultSet query(@WebParam(name="sparcql"**)String sparcql)
>
> where QueryResultSet is:
>
> public class QueryResultSet {
> private List<Object> columnNames;
> private List<Object> resultSet; <- Object will actually be a
> List<Object>
> ... getters and setters
> }
>
> How do you go about annotating the classes so the it gets marshalled
> correctly?
> Thanks.
>
> Barry Hathaway
>
>