You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Brad Harper <br...@gmail.com> on 2007/09/19 02:05:34 UTC

marshaling issue with empty, xsi:nil="true" arrays... ?

I have a bean property which is a List that doesn't seem to be marshaling in
correctly.  When the array is empty in the soap request and xsi:nil="true",
the List is being set with a single null item.  Multiple items are passed in
correctly.

wsdl snippet:
<xs:element maxOccurs="unbounded" minOccurs="0" name="productAttributes"
nillable="true" type="tns:externalProductAttribute"/>

soap request snippet:
<productAttributes xsi:nil="true"/>

bean snippet:
    public List<ExternalProductAttribute> getProductAttributes() {
        return externalProductAttributes;
    }

    public void setProductAttributes(List<ExternalProductAttribute>
productAttributes) {
        this.externalProductAttributes = productAttributes;
    }

I just moved to the latest snapshot today... is this a configuration issue
or a possible bug?

-bh

Re: marshaling issue with empty, xsi:nil="true" arrays... ?

Posted by Daniel Kulp <dk...@apache.org>.
Brad,

I think I need some extra details.....

Is the service that is generating that SOAP message CXF or something 
else?   If it's CXF, this issue is now fixed as part of 
https://issues.apache.org/jira/browse/CXF-970.    It will no longer 
generate the message that way.   It won't write out the 
productAttributes element at all.

If it's NOT CXF, then there isn't much I can do.   The CXF interpretation 
IS a valid interpretation of that schema.   

The XML:
<productAttributes xsi:nil="true"/>
Is a list of length 1 with the item being null.

The XML:
<productAttributes xsi:nil="true"/>
<productAttributes>...data....</productAttributes>
<productAttributes xsi:nil="true"/>
is a list of length 3, with the 1st and 3rd elements null and the second 
having data.

Dan



On Tuesday 18 September 2007, Brad Harper wrote:
> I have a bean property which is a List that doesn't seem to be
> marshaling in correctly.  When the array is empty in the soap request
> and xsi:nil="true", the List is being set with a single null item. 
> Multiple items are passed in correctly.
>
> wsdl snippet:
> <xs:element maxOccurs="unbounded" minOccurs="0"
> name="productAttributes" nillable="true"
> type="tns:externalProductAttribute"/>
>
> soap request snippet:
> <productAttributes xsi:nil="true"/>
>
> bean snippet:
>     public List<ExternalProductAttribute> getProductAttributes() {
>         return externalProductAttributes;
>     }
>
>     public void setProductAttributes(List<ExternalProductAttribute>
> productAttributes) {
>         this.externalProductAttributes = productAttributes;
>     }
>
> I just moved to the latest snapshot today... is this a configuration
> issue or a possible bug?
>
> -bh



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