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 "Stein Henriksen (JIRA)" <ji...@apache.org> on 2007/12/01 14:13:43 UTC

[jira] Commented: (AXIS2-3353) Use wrapper types when elements are optional (i.e.: nillable="true" or minOccurs="0"/maxOccurs="1")

    [ https://issues.apache.org/jira/browse/AXIS2-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547456 ] 

Stein Henriksen commented on AXIS2-3353:
----------------------------------------

I also have the same problem using minOccurs="0" when running wsdl2java from build 01-Dec-2007 07:21. Command line:

call java org.apache.axis2.wsdl.WSDL2Java -or -Euwc -wv 1.1 -s -ss -sd -d adb -ns2p NStoPkg.properties -uri "../xml/document.wsdl" -o "../src" -S "java" -R "resources"

The generated adb beans contain wrappers of the primitives, but the parse method tries to set the wrapped primitives to the plain primitives which fails in compilation (convertToLong returns primitive long):

...
                                    protected java.lang.Long localCollateralId ;
...
                                              object.setCollateralId(
                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToLong(content));
...

> Use wrapper types when elements are optional (i.e.: nillable="true" or minOccurs="0"/maxOccurs="1")
> ---------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3353
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3353
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>    Affects Versions: 1.3
>            Reporter: Mauro Molinari
>            Assignee: Amila Chinthaka Suriarachchi
>            Priority: Critical
>
> As of now, Axis2 WSDL2Java uses some weird convetion about "null".
> I mean, when an element in a WSDL is marked as nillable="true" or minOccurs="0"/maxOccurs="1", the generated Java code still uses primitives types such as int, double, short, long, float, boolean.
> Because of this, I personally experienced (and also read about here in JIRA), Axis2 uses the following questionable convention to handle null values:
> int, short, long => Integer.MIN_VALUE, Short.MIN_VALUE, Long. MIN_VALUE
> float, double => Float.NaN, Double.NaN
> boolean => false
> Actually, these values are NOT null.
> I think Axis2 should map optional elements of type xsd:int, xsd:double, xsd:float, xsd:short, xsd:long, xsd:boolean to, respectively: Integer, Double, Float, Short, Long, Boolean and assign null to them when they are specified as nil or when they are not specified in the SOAP message.
> If I understood it well, Axis1 did this, didn't it?
> At least, I think Axis2 should give an option to enable this and, IMHO, I also think it should be on by default...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org