On Thu, Mar 6, 2008 at 11:18 PM, ahong <[EMAIL PROTECTED]> wrote:

>
> I'm migrating from Axis2 1.1 to 1.3 and notice that WSDL2Java, with adb,
> will
> set an optional xsd:int element value to Integer.MIN_VALUE if it's absent.
> This is a change from the previous in 1.1, which is uninitialized and
> defined by the language (in this case the uninitialized int has value 0).
> Can someone please explain the rationale for this change, since it breaks
> my
> code which assumes a 0 for default.


This is the reason for this.

if your element is optional then their is a possibility to receive a Xml
null value to your element
i.e xsi:nil="true"
So if we use 0 for received null values then you don't know that whether you
received a null or a 0.

So when receiving a null it sets to Integer.MIN_VALUE then you know you have
received an XML null value.

Here in xml even it is possible to receive null values for primitive types.

But if you use jdk 1.5 better to use the Wrapped type elements as Mauro has
said.

thanks,
Amila.

>
>
> I can change the WSDL to have a default value for optional element, but
> it's
> still a bug that default value setting in the WSDL has no effect at
> runtime,
> e.g.,
>  <xsd:element name="skipInterval"     type="xsd:int"    minOccurs="0"
> default="10" />
> does not initialize localSkipInterval to 10 as expected.
>
> %%
> --
> View this message in context:
> http://www.nabble.com/WSDL2Java-Integer.MIN_VALUE-for-optional-xsd%3Aint-tp15879664p15879664.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Reply via email to