I am trying to develop a apache cxf soap webservice and in the generated
wsdl, for the mapping types which are simple types defined in the imported
schema, simply uses basic xml types instead of the actual enums or simple
types, for example.
I have a base xsd, that has an element called Language defined as shown
below:
<xs:simpleType name="Language">
<xs:restriction base="xs:string">
<xs:enumeration value="DE"/>
<xs:enumeration value="EN"/>
<xs:enumeration value="FR"/>
<xs:enumeration value="NL"/>
</xs:restriction>
</xs:simpleType>
I have this based xsd imported in another xsd, and I define Contact type
that has an element called language of type Language as shown below
<xs:element name="Contact" type="Contact"/>
<xs:complexType name="Contact">
<xs:sequence>
<xs:element name="language" type="base:Language" minOccurs="1"
maxOccurs="1"/>
</xs: .......
I have then used jaxb to generate the pojos using which I have defined a
java interface for apache cxf soap based webservice. When I deploy this
webservice and try accessing it with an url in the browser, then I see that
the rendered wsdl has simple xs:String types for all the enums defined, for
example the element Contact above is rendered as shown below where language
is of type string and not Language enum.
<xs:complexType name="Contact">
<xs:sequence>
<xs:element minOccurs="0" name="email" type="xs:string"/>
<xs:element minOccurs="0" name="fax" type="xs:string"/>
<xs:element name="firstName" type="xs:string"/>
<xs:element name="gender" type="xs:string"/>
<xs:element minOccurs="0" name="jobTitle" type="xs:string"/>
<xs:element name="language" type="xs:string"/>
<xs:element name="lastName" type="xs:string"/>
<xs:element minOccurs="0" name="mobile" type="xs:string"/>
<xs:element minOccurs="0" name="phone" type="xs:string"/>
<xs:element name="role" type="xs:string"/>
<xs:element minOccurs="0" name="title" type="xs:string"/>
</xs:sequence>
</xs:complexType>
I see that it could be because jaxb generates pojo class with an
@XmlSchemaType(name = "string") for enum types.
@XmlElement(required = true)
@XmlSchemaType(name = "string")
@NotNull
protected Language language;
If we avoid this, then mappings in the generated wsdl will be correct. Could
you please let me know how to configure jaxb to avoid generating
XmlSchemaTypes for enum types.
Thanks and regards,
Priya
--
View this message in context:
http://cxf.547215.n5.nabble.com/Incorrect-mappings-generated-for-elements-of-simple-types-in-wsdl-tp5753403.html
Sent from the cxf-user mailing list archive at Nabble.com.