You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Tanveer ul Islam <ta...@gmail.com> on 2011/05/18 07:59:47 UTC

Nested Complex Type?

Greetings,

Do anyone know how a web service can return a complex type containing
another complex type? For example i am unable to achieve following:

public class Students {
    List<Student> studentList;
    int totalStudents;
    String bestStudentId;
}


Thanks in advance.

-- 
Thanks | Regards,

*Tanveer ul Islam*

*Senior Java Developer*

*Aim-Force Software*

Re: Nested Complex Type?

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday, May 18, 2011 1:59:47 AM Tanveer ul Islam wrote:
> Greetings,
> 
> Do anyone know how a web service can return a complex type containing
> another complex type? For example i am unable to achieve following:
> 
> public class Students {
>     List<Student> studentList;
>     int totalStudents;
>     String bestStudentId;
> }

This should "just work".   The one caveat is that the List likely should just 
have a "getter" and should be defined as:

 List<Student> studentList = new ArrayList<Student>()

or similar.   JAXB normally calls something like:

students.getStudentList().add(student)

while unmarshalling.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com