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 "McCullough, Ryan" <rm...@rightnow.com> on 2009/04/24 17:57:51 UTC

Question about nillable=true and minOccurs=0

If you have an element on a complexType that has nillable="true" and minOccurs="0", will the element be de-serialized if the property on the soap stub is set to null?

For instance, let's say a portion of your XSD looks like this:
<xs:complexType name="point" >
    <xs:sequence>
        <xs:element name="x" type="xs:int" nillable="true"  minOccurs="0" maxOccurs="1" />
        <xs:element name="y" type="xs:int" nillable="true"  minOccurs="0" maxOccurs="1" />
    </xs:sequence>
</xs:complexType>

If in your generated soap stub object you set x = null and y = 20, will the de-serialized xml look like this:
<point>
    <x xsi:nil="true" />
    <y>20</y>
</point>

I know that Axis 1.4 (not Axis2) will not de-serialize the element when it is set to null and has minOccurs="0". If need be I can dig up the specific code where this happens.

The question I have is if Axis2 also behaves this way?

Ryan McCullough | RightNow Technologies | Integration Tools Engineer
406-556-3162 office | Bozeman, MT | rmccullough@rightnow.com<ma...@rightnow.com> | http://www.rightnow.com<http://www.rightnow.com/>


RE: Question about nillable=true and minOccurs=0

Posted by "McCullough, Ryan" <rm...@rightnow.com>.
Thanks for the quick reply.

From: keith chapman [mailto:keithgchapman@gmail.com]
Sent: Friday, April 24, 2009 10:22 AM
To: axis-user@ws.apache.org
Subject: Re: Question about nillable=true and minOccurs=0

Yes it behaves in the same manner.

Thanks,
Keith.
On Fri, Apr 24, 2009 at 9:27 PM, McCullough, Ryan <rm...@rightnow.com>> wrote:

If you have an element on a complexType that has nillable="true" and minOccurs="0", will the element be de-serialized if the property on the soap stub is set to null?



For instance, let's say a portion of your XSD looks like this:

<xs:complexType name="point" >

    <xs:sequence>

        <xs:element name="x" type="xs:int" nillable="true"  minOccurs="0" maxOccurs="1" />

        <xs:element name="y" type="xs:int" nillable="true"  minOccurs="0" maxOccurs="1" />

    </xs:sequence>

</xs:complexType>



If in your generated soap stub object you set x = null and y = 20, will the de-serialized xml look like this:

<point>

    <x xsi:nil="true" />

    <y>20</y>

</point>



I know that Axis 1.4 (not Axis2) will not de-serialize the element when it is set to null and has minOccurs="0". If need be I can dig up the specific code where this happens.



The question I have is if Axis2 also behaves this way?



Ryan McCullough | RightNow Technologies | Integration Tools Engineer

406-556-3162 office | Bozeman, MT | rmccullough@rightnow.com<ma...@rightnow.com> | http://www.rightnow.com<http://www.rightnow.com/>





--
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

Re: Question about nillable=true and minOccurs=0

Posted by keith chapman <ke...@gmail.com>.
Yes it behaves in the same manner.

Thanks,
Keith.

On Fri, Apr 24, 2009 at 9:27 PM, McCullough, Ryan
<rm...@rightnow.com>wrote:

>  If you have an element on a complexType that has nillable=”true” and
> minOccurs=”0”, will the element be de-serialized if the property on the soap
> stub is set to null?
>
>
>
> For instance, let’s say a portion of your XSD looks like this:
>
> <xs:complexType name="point" >
>
>     <xs:sequence>
>
>         <xs:element name="x" type="xs:int" nillable="true"  minOccurs="0"
> maxOccurs="1" />
>
>         <xs:element name="y" type="xs:int" nillable="true"  minOccurs="0"
> maxOccurs="1" />
>
>     </xs:sequence>
>
> </xs:complexType>
>
>
>
> If in your generated soap stub object you set x = null and y = 20, will the
> de-serialized xml look like this:
>
> <point>
>
>     <x xsi:nil="true" />
>
>     <y>20</y>
>
> </point>
>
>
>
> I know that Axis 1.4 (not Axis2) will not de-serialize the element when it
> is set to null and has minOccurs=”0”. If need be I can dig up the specific
> code where this happens.
>
>
>
> The question I have is if Axis2 also behaves this way?
>
> * *
>
> *Ryan McCullough* | *RightNow Technologies* | Integration Tools Engineer
>
> 406-556-3162 office | Bozeman, MT | rmccullough@rightnow.com |
> http://www.rightnow.com
>
>
>



-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org