Hi Kiran

Yes, it is only JSONProvider that can not *read* explicit collections like
List<Customer> so Customers wrapper would be needed.
With JAXB it should work, please see

http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

testGetBookCollection()
testGetBookArray()
 
base Collection and Sets are also supported

I'll also add the test using WebClients

cheers, Sergey


kiran.sidhu wrote:
> 
> Hi Sergey,
>                Yes, I meant using CXF JAX-RS Client API.
> I was wondering if JAXB can read the xml in the response and generate
> the collection of Customer objects.
> 
> Thanks
> Kiran
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] 
> Sent: Tuesday, August 11, 2009 3:41 AM
> To: [email protected]
> Subject: RE: Handling Collection<JAXBElement> returns via JAX-RS
> 
> 
> Hi
> 
> Do you mean 'using CXF JAXRS client API' ?
> At the moment explicit collections can not be read by JSONProvider
> (Jettison) - I will look into it; otherwise, Sam's message explains how
> collections can be serialized and then read manually by some JSON-aware
> utils. If it is an option and in case you did refer to a client api then
> you
> may be able to do it like this :
> 
> WebClient client = WebClient.create(address);
> InputStream is = client.get(InputStream.class);
> // read JSON collection
> 
> but as I said, we may be able get it fixed
> 
> 
> cheers, Sergey 
> 
> 
> kiran.sidhu wrote:
>> 
>> Has anybody tried getting the collection out from the Response on the
>> client side ?
>> 
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] 
>> Sent: Friday, August 07, 2009 12:28 AM
>> To: [email protected]; [email protected]
>> Subject: RE: Handling Collection<JAXBElement> returns via JAX-RS
>> 
>> Hi Gabo
>> 
>> Yeah, I agree, in some cases names like 'Historys' do no look right
> :-)
>> but it can be tricky to come with the universally acceptable
> collection
>> name, as CXF supports now explicit arrays, lists, base collections and
>> sets. 
>> One can override it by setting a global 'collectionWrapperName' or
>> 'collectionWrapperMap' property on
>> a JAXBElementProvider bean. 'collectionWrapperMap' is a map property,
>> keys are collectionWrapperNames and values are class names, or ex, if
> a
>> given service returns History and Datum then one would use this
>> property.
>> 
>> CollectionWrapperName can be a simple name like 'ListOfHistory' or an
>> expanded QName like
>> '{http://history}ListOfHistory'. In the latter case a 'ns1' prefix
> will
>> be bound to an {http://history} namespace. 
>> 
>> By the way, I've been working on updating the JAX-RS docs for the last
> 2
>> days, so it's all documented now :
>> 
>>
> http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Handlingexplicitcoll
>> ections
>> 
>> but I'm going to spend more time on improving the docs.
>> 
>> thanks, Sergey
>> 
>> -----Original Message-----
>> From: Gabo Manuel [mailto:[email protected]]
>> Sent: Fri 8/7/2009 1:28 AM
>> To: [email protected]
>> Subject: Re: Handling Collection<JAXBElement> returns via JAX-RS
>>  
>> Hi Sergey,
>> 
>>> By default, pluralized XMLRootElement name attribute will be used as
> a
>>> wrapper, namespace-prefixed if needed, if no name attribute is there
>> then a
>>> lower-case pluralized class name will be used. 
>> Just tested the latest release 2.2.3. The rest services handle the 
>> collections. Just a comment though, I think it would be better to use 
>> 'ArrayOf_<XMLRootElement name attribute>'. It just looks weird to have
> a
>> 
>> tag like 'Historys' or 'Datums' (along with other words that have 
>> special case of plurality) or maybe adding an attribute to the 
>> annotation to specify the plural term to be used.
>> 
>> Gabo
>> 
>> 
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _
>> _
>> 
>> Notice: This information is intended only for the person(s) or
> entity(ies)
>> to which it is addressed. This information may contain information
> that is
>> confidential or otherwise protected from disclosure. If you are not
> the
>> intended recipient of this message, or if this message has been
> addressed
>> to you in error, please immediately alert the sender by reply e-mail
> and
>> then delete this message, including any attachments. Any
> dissemination,
>> distribution or other use of the contents of this message by anyone
> other
>> than the intended recipient is strictly prohibited.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Handling-Collection%3CJAXBElement%3E-returns-via-J
> AX-RS-tp24262522p24915229.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _
> 
> Notice: This information is intended only for the person(s) or entity(ies)
> to which it is addressed. This information may contain information that is
> confidential or otherwise protected from disclosure. If you are not the
> intended recipient of this message, or if this message has been addressed
> to you in error, please immediately alert the sender by reply e-mail and
> then delete this message, including any attachments. Any dissemination,
> distribution or other use of the contents of this message by anyone other
> than the intended recipient is strictly prohibited.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Handling-Collection%3CJAXBElement%3E-returns-via-JAX-RS-tp24262522p24931544.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to