ahong ha scritto:
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.

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.

%%

I never agreed with the Integer.MIN_VALUE convention adopted in Axis2, so I opened a bug some time ago:
https://issues.apache.org/jira/browse/AXIS2-3353

In a recent Axis2 nightly build, you can use WSDL2Java -Euwc parameter so that optional parameters (those with minOccurs="0" or nillable="true" attributes) are translated into Integer rather than int and they are set to null if not specified.

Please note that your project must use a Java5 compiler to compile ADB code generated with -Euwc parameter.

Cheers.

--
Mauro Molinari
Software Developer
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to