windows XP, jdk1.6, CXF2.3
test.wsdl文件:
<xs:complexType name="CalendarTime"> <xs:sequence> <xs:choice> <xs:element name="day" type="xs:unsignedInt"/> <xs:element name="week" type="xs:unsignedInt"/> </xs:choice> <xs:element name="seconds" type="xs:unsignedInt"/> </xs:sequence> </xs:complexType>
利用CXF2.3的wsdl2java命令生成javaBean如下:
public class CalendarTime { @XmlSchemaType(name = "unsignedInt") protected Long day; @XmlSchemaType(name = "unsignedInt") protected week week; @XmlSchemaType(name = "unsignedInt") protected long seconds; ...... }
wsdl中day、week、seconds同样定义为type="xs:unsignedInt",生成的javaBean的类型却不同:
day--- Long
week-- Long
seconds-- long
后来实验发现:<xs:choice>包含的类型都会生成基本类型封装类,而在<xs:choice>之外的则生成基本类型。
不知道这是为什么,有哪位高人指点一下?