cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <glen.ma...@gmail.com>
Subject Re: wsdl2java data type mapping discrepancy
Date Thu, 20 May 2010 23:17:59 GMT

I think the reason is that optional elements need to be an Integer instead of
just an int because the former lets you specify that no value was provided
(you can set an Integer to null but not an int).

Glen


Maharajapuram Ramchandran wrote:
> 
> Hello,
> 
> We are using CXF 2.2.2 to write a webservice and I'm running into this
> issue:
> 
> I have 2 operations in the service and for a particular node this is what
> I
> have in the XSD. As you can see, the only difference that I have is that
> the
> ID is an optional element in the second operation.
> 
> *Operation1:*
> 
> <xs:element name="ID" type="ID1"/>
> 
> <xs:simpleType name="ID1">
> 
> <xs:restriction base="xs:int">
> 
> <xs:pattern value="[0-9]{9}"/>
> 
> </xs:restriction>
> 
> 
> *Operation2*
> 
> <xs:element name="ID" type="ID1" minOccurs="0"/>
> 
> <xs:simpleType name="ID1">
> 
> <xs:restriction base="xs:int">
> 
> <xs:pattern value="[0-9]{9}"/>
> 
> </xs:restriction>
> 
> </xs:simpleType>
> 
> 
> 
> When we generate the stubs using wsdl2java, the first one is getting
> generated as
> 
> 
> protected int ID;
> 
> and the second one is
> 
> protected Integer requestorID;
> 
> I did go through the Aegis default mapping details (
> http://cxf.apache.org/docs/aegis-theory-of-operation.html) and it says
> that
> xs:int can be mapped to int or Integer, but I'm curious to know why is
> this
> behaving differently. Is there a reason behind this or it is just random?
> If
> not, Is there a way to get this generated as an Integer. Or should we
> change
> the code manually? Is it a good practice to do that?
> 
> Would like to know if someone has faced this discrepancy before! Thanks..
> 
> 

-- 
View this message in context: http://old.nabble.com/wsdl2java-data-type-mapping-discrepancy-tp28624667p28628084.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message