You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Brook Richan <br...@sandlot.com> on 2003/12/08 22:17:54 UTC

Re: minOccurs="0" gummed up sometime between 2003-11-5 and2003-12-5

dims,

I see you closed bug 20109 and said the fix is in the latest cvs.

Hoping this would fix the problem related to 20109 I reported last
Friday, I just now got the latest from cvs, and the only thing that
changed since my last checkout on 2003-12-5 was BeanDeserializer.java,
which fixed 25179, not 20109.

I'm still getting the problem I mentioned on Friday, which is
<xsd:element name="something" type="xsd:int" minOccurs="0"/> now causes
WSDL2Java to generate the type for "something" as an "int". A month ago
it used to be "java.lang.Integer", which allowed the minOccurs="0" to be
handled. Now, the minOccurs="0" can not be handled, and so the element
"something" is ALWAYS serialized.

If the value of "something" has never been set, it gets serialized as
0. This means it is impossible to distinguish between the value 0 and
not-specified.

What am I missing, and why did this behavior change in axis within the
last 30 days?

Thanks,
Brook

>>> brichan@sandlot.com 12/05/03 05:41PM >>>
I just got the latest Axis code today and something has gummed up the
treatment of minOccurs="0".

I did a compare of the previous version of the axis code I had, which
was just 30 days old, and there is so much changed that it would take
a
while to fish around to see what happened. Perhaps someone who has
changed the code in the last 30 days might know quicker.

Here is the problem:

The xsd has:
  <xsd:element name="orderhdr" type="xsd:int" minOccurs="0"/>

With old 2003-11-5 code, the data type generated for orderhdr was
"java.lang.Integer".
With new 2003-12-5 code, the data type generated for orderhdr is now
"int".

This means the serializer can't know whether to generate the element
or
not, so it always gets generated. So, in its initialized state I get
serialized:
  <orderhdr>0</orderhdr>

This is not good.

With the 2003-11-5 code, no element was generated, as expected.

I can see two bug reports that are sort of related, talking about
nillable and minOccurs: 15566 and 20109. But both are still marked
NEW,
with no history on them for several months.

So, anybody know what changed and how to go about fixing it?

btw: .NET deals with this issue the same way Axis was dealing with it
prior to whatever changed recently.

Re: minOccurs="0" gummed up sometime between 2003-11-5 and2003-12-5

Posted by Davanum Srinivas <di...@yahoo.com>.
Brook,

20109 says that WSDL2Java generates wrong code in the sense that it replaces xsd:boolean with 
soapenc equivalent. This behavior does not existing in latest CVS. Hence i closed the bug. 

Please open a new bug with a stripped down test case for your specific problem - "when
minOccurs="0" is specified use java.lang.Integer instead of int".

Thanks,
dims

--- Brook Richan <br...@sandlot.com> wrote:
> dims,
> 
> I see you closed bug 20109 and said the fix is in the latest cvs.
> 
> Hoping this would fix the problem related to 20109 I reported last
> Friday, I just now got the latest from cvs, and the only thing that
> changed since my last checkout on 2003-12-5 was BeanDeserializer.java,
> which fixed 25179, not 20109.
> 
> I'm still getting the problem I mentioned on Friday, which is
> <xsd:element name="something" type="xsd:int" minOccurs="0"/> now causes
> WSDL2Java to generate the type for "something" as an "int". A month ago
> it used to be "java.lang.Integer", which allowed the minOccurs="0" to be
> handled. Now, the minOccurs="0" can not be handled, and so the element
> "something" is ALWAYS serialized.
> 
> If the value of "something" has never been set, it gets serialized as
> 0. This means it is impossible to distinguish between the value 0 and
> not-specified.
> 
> What am I missing, and why did this behavior change in axis within the
> last 30 days?
> 
> Thanks,
> Brook
> 
> >>> brichan@sandlot.com 12/05/03 05:41PM >>>
> I just got the latest Axis code today and something has gummed up the
> treatment of minOccurs="0".
> 
> I did a compare of the previous version of the axis code I had, which
> was just 30 days old, and there is so much changed that it would take
> a
> while to fish around to see what happened. Perhaps someone who has
> changed the code in the last 30 days might know quicker.
> 
> Here is the problem:
> 
> The xsd has:
>   <xsd:element name="orderhdr" type="xsd:int" minOccurs="0"/>
> 
> With old 2003-11-5 code, the data type generated for orderhdr was
> "java.lang.Integer".
> With new 2003-12-5 code, the data type generated for orderhdr is now
> "int".
> 
> This means the serializer can't know whether to generate the element
> or
> not, so it always gets generated. So, in its initialized state I get
> serialized:
>   <orderhdr>0</orderhdr>
> 
> This is not good.
> 
> With the 2003-11-5 code, no element was generated, as expected.
> 
> I can see two bug reports that are sort of related, talking about
> nillable and minOccurs: 15566 and 20109. But both are still marked
> NEW,
> with no history on them for several months.
> 
> So, anybody know what changed and how to go about fixing it?
> 
> btw: .NET deals with this issue the same way Axis was dealing with it
> prior to whatever changed recently.


=====
Davanum Srinivas - http://webservices.apache.org/~dims/