You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Pangburn, Jesse" <Je...@us.lawson.com> on 2010/09/22 01:20:25 UTC

axis2 1.4 serializes minOccurs="0" element even when set to null

Hi,
I have a pojo service where the response object contains a lot of fields that show up like this in the WSDL:
<xs:element minOccurs="0" name="comments" nillable="true" type="xs:string"/>

When I return the containing object with comments field set to null, I would expect not to see it serialized but in the response XML I see:
<ax22:comments xsi:nil="true" />

This is really bloating the size of the response object because in some cases the majority of the fields are null.  Since it's minOccurs="0", my understanding is that it's perfectly legal for Axis2 to not return that element.  Is there a setting or something I can do to tell Axis2 to make this optimization?

Thanks,
Jesse


RE: axis2 1.4 serializes minOccurs="0" element even when set to null

Posted by "Pangburn, Jesse" <Je...@us.lawson.com>.
Thanks for the reply!  I didn't think I have control over that as I have a POJO service, so I just defined my service class in the services.xml file and then build the appropriate URL + ?wsdl and I get the WSDL back from Axis2.  How do I remove the nillable attribute when Axis is the one generating the WSDL file?

Thanks,
Jesse

From: Stephen Hall [mailto:shall@starmountsystems.com]
Sent: Tuesday, September 21, 2010 6:05 PM
To: java-user@axis.apache.org
Subject: Re: axis2 1.4 serializes minOccurs="0" element even when set to null

Remove the nillable attribute.or set it to false. When it's set to true it means 'its okay to populate this element with an xsi:nil="true"', which is unnecessary since minOccurs is set to zero.
On Tue, Sep 21, 2010 at 6:20 PM, Pangburn, Jesse <Je...@us.lawson.com>> wrote:
Hi,
I have a pojo service where the response object contains a lot of fields that show up like this in the WSDL:
<xs:element minOccurs="0" name="comments" nillable="true" type="xs:string"/>

When I return the containing object with comments field set to null, I would expect not to see it serialized but in the response XML I see:
<ax22:comments xsi:nil="true" />

This is really bloating the size of the response object because in some cases the majority of the fields are null.  Since it's minOccurs="0", my understanding is that it's perfectly legal for Axis2 to not return that element.  Is there a setting or something I can do to tell Axis2 to make this optimization?

Thanks,
Jesse



Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s).  If you have received this communication in error, any disclosure or use of such information is strictly prohibited.  Please notify the sender immediately and destroy all copies.  Thank you.



Re: axis2 1.4 serializes minOccurs="0" element even when set to null

Posted by Stephen Hall <sh...@starmountsystems.com>.
Remove the nillable attribute.or set it to false. When it's set to true it
means 'its okay to populate this element with an xsi:nil="true"', which
is unnecessary since minOccurs is set to zero.

On Tue, Sep 21, 2010 at 6:20 PM, Pangburn, Jesse <
Jesse.Pangburn@us.lawson.com> wrote:

>  Hi,
>
> I have a pojo service where the response object contains a lot of fields
> that show up like this in the WSDL:
>
> <xs:element minOccurs="0" name="comments" nillable="true"
> type="xs:string"/>
>
>
>
> When I return the containing object with comments field set to null, I
> would expect not to see it serialized but in the response XML I see:
>
> <ax22:comments xsi:nil="true" />
>
>
>
> This is really bloating the size of the response object because in some
> cases the majority of the fields are null.  Since it’s minOccurs=”0”, my
> understanding is that it’s perfectly legal for Axis2 to not return that
> element.  Is there a setting or something I can do to tell Axis2 to make
> this optimization?
>
>
>
> Thanks,
>
> Jesse
>
>
>

Disclaimer: The information contained in this communication is confidential and only for the use of the intended addressee(s).  If you have received this communication in error, any disclosure or use of such information is strictly prohibited.  Please notify the sender immediately and destroy all copies.  Thank you.