I am having a WSDL which I must use and not modify.
In the WSDL there is a type 'TextType' defined without any elements. This 'TextType' is actually meant as simple String (which is only described in a separate documentation file)
<xs:complexType name="TextType">
</xs:complexType>
TextType is then used in XSD file as usual:
<xs:complexType name="AnschriftType">
<xs:element name="Strasse" type="xs:string"/>
</xs:complexType>
I know, this WSDL is not really usable nor a good design. The provider of this WSDL already changed it in a newer version. But anyway I have to stick on that faulty version :-/
From this JXB generates theses Pojos:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TextType")
public class TextType {
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AnschriftType" propOrder={...})
public class AnschriftType {
@XmlElement(name = "Strasse")
protected TextType strasse;
public TextType getStrasse() {
return strasse;
}
public void setStrasse(TextType value) {
this.strasse = value;
}
}
Is it somehow possible to let JAXB generate the Pojos with 'String' instead of 'TextType'?
I already tried something but didn't work so far...
1)
<jaxb:bindings node="xs:complexType[@name='TextType']">
<jaxb:class name="String" implClass="java.lang.String"/>
</jaxb:bindings>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AnschriftType" propOrder={...})
public class AnschriftType {
@XmlElement(name = "Strasse", type = java.lang.String.class)
protected java.lang.String strasse;
public package.of.xsd.String getStrasse() {
return strasse;
}
public void setStrasse(package.of.xsd.String value) {
this.strasse = ((java.lang.String) value);
}
}
<jaxb:bindings node="xs:complexType[@name='TextType']">
<jaxb:property>
<jaxb:baseType name="java.lang.String"/>
</jaxb:property>
</jaxb:bindings>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AnschriftType" propOrder={...})
public class AnschriftType {
@XmlElement(name = "Strasse")
protected TextType strasse;
public TextType getStrasse() {
return strasse;
}
public void setStrasse(TextType value) {
this.strasse = value;
}
}