my dog learned polymorphism
The moose likes Web Services and the fly likes MaxLength Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "MaxLength" Watch "MaxLength" New topic


Suri Babs
Ranch Hand

Joined: Mar 27, 2003
Posts: 50
Hi All,

Apache Axis 1.4 WSDL2Java is not generating code for maxLength

<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:maxLength value="10"/>

Is there any alternative on how to handle this or Is there any way to make Axis generate this code?

Help is required on this.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
I am not entirely sure, but I think that JAXB will not generate code that enforces maxLength either.
What you can do is:
1) Add code to enforce maxLength in the generated class.
A less good approach, if you ever re-generate the code.
2) Create a subclass of the generated class and override method(s) to enforce maxLength.
A better approach.
3) Use AOP to instrument the generated class to add enforcement of the maxLength.
Also a better approach, compared to 1.
Best wishes!
I agree. Here's the link:
subject: MaxLength
It's not a secret anymore!