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 Luis Rivera <lu...@gmail.com> on 2010/01/26 00:53:20 UTC

Fwd: WSDL optional attributes

Hi,

I tried in the user's axis mailing list. Nobody seemed to know anything
about this, so I am now trying the dev list and see if someone can dissipate
the problems I am having with the axis2 generator!

I have a problem with the wsdl2java code generation in axis2 for optional
attributes

In short, how can I make it generate Objects intead of primitives for
OPTIONAL ATTRIBUTES?

Axis1 would generate them as Objects, which was great since I could look for
nulls as a sign that the client had not include them in the message.

However, with Axis2, the class end up with primitives, instead of objects
(e.g. int instead of Integer).

. Take the following extract from my WSDL schema:

...
<xsd:attributeGroup name="ccAttributes">
     <xsd:attribute name="ccCGMS_A" type="xsd:int" use="optional"/>
     <xsd:attribute name="ccACP" type="xsd:int" use="optional"/>
     <xsd:attribute name="ccDwightCavendish" type="xsd:boolean"
use="optional"/>
     <xsd:attribute name="ccHDCP" type="xsd:boolean" use="optional"/>
 </xsd:attributeGroup>
<xsd:attributeGroup name="osdAttributes">
     <xsd:attribute name="osdActive" type="xsd:boolean" use="optional"/>
     <xsd:attribute name="osdDuration" type="xsd:int" use="optional"/>
     <xsd:attribute name="osdType" type="xsd:int" use="optional"/>
     <xsd:attribute name="osdLocation" type="xsd:int" use="optional"/>
 </xsd:attributeGroup>
<xsd:complexType name="streamAttributes">
                <xsd:attribute name="channelNumber" type="xsd:int"
use="required"/>
                <xsd:attribute name="sourcePort" type="xsd:int"
use="required"/>
                <xsd:attribute name="sourceAddress" type="xsd:string"
use="required"/>
                <xsd:attribute name="targetPort" type="xsd:int"
use="required"/>
                <xsd:attribute name="targetAddress" type="xsd:string"
use="required"/>
                <xsd:attribute name="level" type="xsd:byte" use="required"/>
                <xsd:attribute name="mutationInterval" type="xsd:long"
use="required"/>
                <xsd:attribute name="insertionInterval" type="xsd:long"
use="required"/>
                <xsd:attribute name="type" type="xsd:byte" use="required"/>
                <xsd:attribute name="description" type="xsd:string"
use="required"/>
                <xsd:attribute name="ID" type="xsd:string" use="required"/>
                <xsd:attributeGroup ref="ns:ccAttributes" />
                <xsd:attributeGroup ref="ns:osdAttributes" />
            </xsd:complexType>
...

So, how could I coerce the axis2 generator to behave like axis1 in this
particular issue?

Thanks in advance,
--Luis R.

Fwd: WSDL optional attributes

Posted by Luis Rivera <lu...@gmail.com>.
Hi,

This is my send try. I guess I will need to open JIRA bug for this, since
nobody seems to know what this happens!

I have a problem with the wsdl2java code generation in axis2 for optional
attributes

In short, how can I make it generate Objects instead of primitives for
OPTIONAL ATTRIBUTES?

Axis1 would generate them as Objects, which was great since I could look for
nulls as a sign that the client had not include them in the message.

However, with Axis2, the class end up with primitives, instead of objects
(e.g. int instead of Integer).

. Take the following extract from my WSDL schema:

...
<xsd:attributeGroup name="ccAttributes">
     <xsd:attribute name="ccCGMS_A" type="xsd:int" use="optional"/>
     <xsd:attribute name="ccACP" type="xsd:int" use="optional"/>
     <xsd:attribute name="ccDwightCavendish" type="xsd:boolean"
use="optional"/>
     <xsd:attribute name="ccHDCP" type="xsd:boolean" use="optional"/>
 </xsd:attributeGroup>
<xsd:attributeGroup name="osdAttributes">
     <xsd:attribute name="osdActive" type="xsd:boolean" use="optional"/>
     <xsd:attribute name="osdDuration" type="xsd:int" use="optional"/>
     <xsd:attribute name="osdType" type="xsd:int" use="optional"/>
     <xsd:attribute name="osdLocation" type="xsd:int" use="optional"/>
 </xsd:attributeGroup>
<xsd:complexType name="streamAttributes">
                <xsd:attribute name="channelNumber" type="xsd:int"
use="required"/>
                <xsd:attribute name="sourcePort" type="xsd:int"
use="required"/>
                <xsd:attribute name="sourceAddress" type="xsd:string"
use="required"/>
                <xsd:attribute name="targetPort" type="xsd:int"
use="required"/>
                <xsd:attribute name="targetAddress" type="xsd:string"
use="required"/>
                <xsd:attribute name="level" type="xsd:byte" use="required"/>
                <xsd:attribute name="mutationInterval" type="xsd:long"
use="required"/>
                <xsd:attribute name="insertionInterval" type="xsd:long"
use="required"/>
                <xsd:attribute name="type" type="xsd:byte" use="required"/>
                <xsd:attribute name="description" type="xsd:string"
use="required"/>
                <xsd:attribute name="ID" type="xsd:string" use="required"/>
                <xsd:attributeGroup ref="ns:ccAttributes" />
                <xsd:attributeGroup ref="ns:osdAttributes" />
            </xsd:complexType>
...

So, how could I coerce the axis2 generator to behave like axis1 in this
particular issue?

Thanks in advance,
--Luis R.