axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mauro Molinari (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-3353) Use wrapper types when elements are optional (i.e.: nillable="true" or minOccurs="0"/maxOccurs="1")
Date Fri, 07 Dec 2007 08:57:44 GMT

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

Mauro Molinari commented on AXIS2-3353:
---------------------------------------

Hi Amila!
minOccurs="0" problem seems to be fixed, thank you!

However, regarding the response unwrapping, it now works if responses are defined as elements
of anonymous empty types, but still doesn't work when responses are defined as elements of
global empty types. Please try the -uw parameter with the following WSDL, that shows all the
cases (input and output empty types unwrapping, both using empty anonymous or global types).
You'll see that method b is not void, but returns EmptyType:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://mauro/Prova"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProvaService"
  targetNamespace="http://mauro/Prova"
  xmlns:txsns="http://mauro/Prova/type">
  <wsdl:types>
    <xsd:schema targetNamespace="http://mauro/Prova/type"
      xmlns:txsns="http://mauro/Prova/type">
      <xsd:element name="aMethod">
        <xsd:complexType>

        </xsd:complexType>
      </xsd:element>

      <xsd:element name="aMethodResponse">
        <xsd:complexType />
      </xsd:element>

      <xsd:complexType name="EmptyType" />

      <xsd:element name="bMethodResponse" type="txsns:EmptyType">

      </xsd:element>

      <xsd:element name="bMethod" type="txsns:EmptyType" />
    </xsd:schema>
  </wsdl:types>

  <wsdl:message name="aMethodRequest">
    <wsdl:part element="txsns:aMethod" name="parameters" />
  </wsdl:message>
  <wsdl:message name="aMethodResponse">
    <wsdl:part element="txsns:aMethodResponse" name="parameters" />
  </wsdl:message>
  <wsdl:message name="bMethodRequest">
    <wsdl:part name="parameters" element="txsns:bMethod"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="bMethodResponse">
    <wsdl:part name="parameters" element="txsns:bMethodResponse"></wsdl:part>
  </wsdl:message>
  <wsdl:portType name="ProvaService">
    <wsdl:operation name="aMethod">
      <wsdl:input message="tns:aMethodRequest" />
      <wsdl:output message="tns:aMethodResponse" />
    </wsdl:operation>
    <wsdl:operation name="bMethod">
      <wsdl:input message="tns:bMethodRequest"></wsdl:input>
      <wsdl:output message="tns:bMethodResponse"></wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ProvaServiceSOAP" type="tns:ProvaService">

    <soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="aMethod">

      <soap:operation soapAction="http://mauro/Prova/aMethod" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="bMethod">
      <soap:operation soapAction="http://mauro/Prova/bMethod" />

      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>

        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="ProvaService">
    <wsdl:port binding="tns:ProvaServiceSOAP" name="ProvaServiceSOAP">
      <soap:address location="http://www.example.org/" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Do you prefer me open a new issue for this or do you think here is enough?

Mauro.

> 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


Mime
View raw message