Return-Path: Delivered-To: apmail-incubator-cxf-user-archive@locus.apache.org Received: (qmail 70939 invoked from network); 3 Oct 2007 10:13:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 10:13:25 -0000 Received: (qmail 21673 invoked by uid 500); 3 Oct 2007 10:13:13 -0000 Delivered-To: apmail-incubator-cxf-user-archive@incubator.apache.org Received: (qmail 21621 invoked by uid 500); 3 Oct 2007 10:13:13 -0000 Mailing-List: contact cxf-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-user@incubator.apache.org Delivered-To: mailing list cxf-user@incubator.apache.org Received: (qmail 21612 invoked by uid 99); 3 Oct 2007 10:13:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 03:13:13 -0700 X-ASF-Spam-Status: No, hits=-0.8 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS,TVD_FW_GRAPHIC_NAME_MID X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kdwalton@us.ibm.com designates 32.97.182.141 as permitted sender) Received: from [32.97.182.141] (HELO e1.ny.us.ibm.com) (32.97.182.141) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 10:13:12 +0000 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e1.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id l93A9gQS010106 for ; Wed, 3 Oct 2007 06:09:42 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l93A9gVa673352 for ; Wed, 3 Oct 2007 06:09:42 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l93A9gwU004060 for ; Wed, 3 Oct 2007 06:09:42 -0400 Received: from d01ml064.pok.ibm.com (d01ml064.pok.ibm.com [9.56.228.131]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l93A9fgX004048 for ; Wed, 3 Oct 2007 06:09:41 -0400 In-Reply-To: <200710021746.31888.dkulp@apache.org> References: <200710021746.31888.dkulp@apache.org> Subject: Re: Empty List's not being marshaled? To: Daniel Kulp Cc: cxf-user@incubator.apache.org X-Mailer: Lotus Notes Release 8.0 August 02, 2007 Message-ID: From: Kaleb Walton Date: Wed, 3 Oct 2007 06:09:33 -0400 X-MIMETrack: Serialize by Router on D01ML064/01/M/IBM(Release 7.0.2FP2 IGS702FP2HF2|August 8, 2007) at 10/03/2007 06:09:41 MIME-Version: 1.0 Content-type: multipart/related; Boundary="0__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070" X-Virus-Checked: Checked by ClamAV on apache.org --0__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070 Content-type: multipart/alternative; Boundary="1__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070" --1__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: quoted-printable Thank you! Do you know why that is the case? Maybe because since it's empty they figured there shouldn't be any wasted space in the XML doc? It's a pain for my consumers to have to check for the existence of a variable before trying to parse it out - not the end of the world but i= t adds somewhat redundant code. Regards, Kaleb |------------> | From: | |------------> >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |Daniel Kulp = = | >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |------------> | To: | |------------> >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |cxf-user@incubator.apache.org = = | >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |------------> | Cc: | |------------> >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |Kaleb Walton/Southfield/IBM@IBMUS = = | >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |------------> | Date: | |------------> >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |10/02/2007 05:55 PM = = | >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |------------> | Subject: | |------------> >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| |Re: Empty List's not being marshaled? = = | >--------------------------------------------------------------------= -----------------------------------------------------------------------= -------| On Tuesday 02 October 2007, Kaleb Walton wrote: > I'm using the simple server configured via Spring. When an object > contains an empty list (not null) my response does not return it as a= n > empty list - it just excludes the property from the response. Is ther= e > any way to force it to include the property? I'd probably have to see both the schema and the soap message. Most likely, the answer is no without creating a holder bean to hold the list. For the most part, when we see something like List, we just create: In that case, if the list is empty (or even if the list is null), nothi= ng representing the list will appear on the wire. That is how the JAXB spec calls for it to be done. If you want something always on the wire= , the schema would have to be something like: and a "FooList" class would be created to hold the List. -- J. Daniel Kulp Principal Engineer IONA P: 781-902-8727 C: 508-380-7194 daniel.kulp@iona.com http://www.dankulp.com/blog = --1__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070 Content-type: text/html; charset=US-ASCII Content-Disposition: inline Content-transfer-encoding: quoted-printable

Thank you!

Do you know why that is the case? Maybe because since it's empty they f= igured there shouldn't be any wasted space in the XML doc?

It's a pain for my consumers to have to check for the existence of a va= riable before trying to parse it out - not the end of the world but it = adds somewhat redundant code.


Regards,
Kaleb

3D"InactiveDaniel Kulp ---10/02/2007 05:55:00= PM---On Tuesday 02 October 2007, Kaleb Walton wrote:

= =
3D=
From:
= 3D""
Daniel Kulp <dkulp@apache.org>
3D=
To:

cxf-user@incubator.apache.org
3D=
Cc:
3D""
Kaleb Walton/Southfield/IBM@IBMUS
3D=
Date:
= 3D""
10/02/2007 05:55 PM
3D=
Subject:
3D""
Re: Empty List's not being marshaled?





On Tuesday 02 October 2007, Kaleb Walton wrote:
> I'm using the simple server configured via Spring. When an object<= br> > contains an empty list (not null) my response does not return it a= s an
> empty list - it just excludes the property from the response. Is t= here
> any way to force it to include the property?

I'd probably have to see both the schema and the soap message.   M= ost
likely, the answer is no without creating a holder bean to hold the list.  

For the most part, when we see something like List<String>, we ju= st
create:
<element name=3D"foo" type=3D"string" maxOccurs=3D= "unbounded" nillable=3D"true"/>

In that case, if the list is empty (or even if the list is null), nothi= ng
representing the list will appear on the wire.   That is how the J= AXB
spec calls for it to be done.  If you want something always on the= wire,
the schema would have to be something like:
<element name=3D"fooList">
<complexType>
<sequence>
<element name=3D"foo" type=3D"string" maxOccurs=3D= "unbounded" nillable=3D"true"/>
</sequence>
<complexType>
</element>

and a "FooList" class would be created to hold the List<St= ring>.

--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com= /blog

= --1__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070-- --0__=0ABBF9FADFA420708f9e8a93df938690918c0ABBF9FADFA42070--