This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "MaxLength" Watch "MaxLength" New topic
Author

MaxLength

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.

Thanks
Suresh
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MaxLength
 
Similar Threads
Struts Validator-Validating an Integer Form Field
Displaying date in text box
Information lost on error.
maxlength validation not working
Problem with SOAP