I faced that problem a little while ago and I am under the impression that the setter should be generated accordingly to perform validation. This would allow Axis to support other restrictive types like xsd:TOKEN, xsd:NMTOKEN, xsd:NCName as well as custom ones.
Sylvain. -----Original Message----- From: dev [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 4:00 AM To: [EMAIL PROTECTED] Subject: Re: WSDL2Java: how to manage schema restriction/facets Hello, this is a repost. I hope somebody can help me: How to perform a validation of the resquest parameters against according to the wsdl schema ? am writing wsdl to generate both client and server side java code. wsdl is xml and supporte schemas. With schema we can apply some restrictions also called facets to data like: <xsd:simpleType name="cardNumberType"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{16}"/> </xsd:restriction> </xsd:simpleType> I am using beta2. For each type with a restriction, wsdl2java generate a Class describing the type: public class CardNumberType implements java.io.Serializable, org.apache.axis.encoding.SimpleType { private java.lang.String value; public CardNumberType()... public java.lang.String getValue().. public void setValue(java.lang.String value)... public CardNumberType(java.lang.String value) private Object __equalsCalc = null; public synchronized boolean equals(Object obj)... private boolean __hashCodeCalc = false; public synchronized int hashCode()... public static org.apache.axis.encoding.Serializer getSerializer().. public static org.apache.axis.encoding.Deserializer getDeserializer().. } That 's good, but the generated class doesn't check the format to be sure it is valid with the wsdl/schema definition. If the request send a "malformed" data, all is working without any "format error", that is, there is no automatic validation of the data performed by axis based on the wsdl and the schema. How can I perform this validation, should I: - add the validation in each Class type generate by the wsdl2java? or - create an handler that parse the request and validate it accordingly to the wsdl and schema? or - other idea? Is there something planed to do the job in further version? Or did I miss something ? Many thanks, Cedric This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.
