I have a WSDL + XSD that needs to be turned into Java classes. That's pretty simple - wsimport
will handle that without issue. However, I also need to be able to add annotations to the generated classes, and those annotations need to contain information that is contained in the XSD (in particular, they need to reference the xsd:maxLength
or xsd:length
properties).
Why? Because I plan to transform them into a flat file afterwards, using Bindy. For reference, I know that I can use Annox to add custom annotations to the generated classes, but as far as I'm aware, that would require that either all annotations are identical, with all parameters being identical, or specifying annotations for each element individually, with no way to specify the annotation once along with some way (e.g. xpath) of specifying that the value of one of the parameters should be different for each element.
That is, given a schema extract like
<xsd:element name="smapleRequest">
<xsd:sequence>
<xsd:element name="ELEMENT_ONE">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="3" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ELEMENT_TWO">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:element>
I would like to see classes that look this:
.
.
.
@FixedLengthRecord
public class SampleRequest {
@XmlElement(name = "ELEMENT_ONE", required = true)
@DataField(pos = 1, length=3)
protected String elementOne;
@XmlElement(name = "ELEMENT_TWO", required = true)
@DataField(pos = 4, length=8)
protected String elementTwo;
.
.
.
}
Ideally, I would like to be able to do this without having to duplicate all the information from the XSD into the JAXB Binding File. I mean, I could, but with potentially hundreds of elements per web service method, and dozens of methods, that would get very, very old very, very fast. At that point, I would probably have to use another tool to generate the XSD and JAXB binding file(s) from the COBOL!
So, does anyone know if this is possible? Have I just missed something in Annox? Or am I just asking for too much here?