It actually isn't hard to fix.  I am using the @ElementClass annotation to show 
that the service returns elements of that.  And your WADLGenerator already 
handles that.  The issue is that ResourceUtils.getAllRequestResponseTypes 
doesn't include the SomeObject in the list returned.  I overrode the 
WadlGenerator to then include the element in the list and it worked fine.  Does 
that help?

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]] 
Sent: Monday, August 22, 2011 3:07 AM
To: [email protected]
Subject: Re: Problem with WADL generation and returning a List of objects

Hi

The reason SomeObject from List<SomeObject> is not currently checked
in for the purpose of
the WADL grammar generation is that a SomeObject schema element
instance can not be used to
describe the actual value represented by List<SomeObject>.

For example, assuming SomeObject can be represented as
<SomeObject/>, List<SomeObject> (say with a single element) will be
represented by default as
 <SomeObjects><SomeObject/></SomeObjects>.

I don't know at the moment how to get a schema element which would describe
<SomeObjects><SomeObject/></SomeObjects>

generated from List<SomeObject>...SomeObjects is a default wrapper but
alternative names can be configured...

Thus even if we generate a schema SomeObject element,
we won't be able to link to it from a given WADL response or request
representation which is supposed to be List<SomeObject>.

If it's feasible then I can get it fixed, just not sure how...
In meantime a workaround is to use a collection bean, or configure CXF
WADL generator with a reference to the custom schema or even WADL
instance

Cheers, Sergey
On Thu, Aug 18, 2011 at 9:55 PM, Daniel Kulp <[email protected]> wrote:
>
> This definitely sounds like a bug.   Can you log an issue (and maybe attach a
> patch?)
>
> Thanks!
> Dan
>
>
> On Thursday, August 18, 2011 2:42:42 PM Timothy Paul Hanna wrote:
>> I have a service that returns a list of objects using application/xml.  The
>> WADL doesn't display these object in the grammar nor connects them to the
>> operations response.
>>
>> While debugging in CXF it seems the problem is in
>> ResourceUtils.getAllRequestResponseTypes The problem is the this method
>> doesn't include the parameterized objects in Lists on return methods.  For
>> example if I have the service below
>>
>> public List<SomeObject> getSomeObjects()
>>
>> SomeObject will not be included as a JAXB object even if I have
>> @XMLRootElement declared.  It will be included if I have any of the other
>> services
>>
>> public void storSomeObjects(List<SomeObject>)
>>
>> public SomeObject getSomeObject(Long id)
>>
>> If I have either of the two above methods in my service, then SomeObject
>> will be picked up as a JAXB object and then my WADL will display my
>> "getSomeObjects"definition correctly.
>>
>> This doesn't seem to be consistent. What was the intent of not handling
>> Lists as a return type?
>>
>> Tim
>>
>>
>>  NOTICE: This email message is for the sole use of the intended recipient(s)
>> and may contain confidential and privileged information. Any unauthorized
>> review, use, disclosure or distribution is prohibited. If you are not the
>> intended recipient, please contact the sender by reply email and destroy
>> all copies of the original message.
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> Talend - http://www.talend.com
>



-- 
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com


 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.


Reply via email to