You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by dev <de...@chez.com> on 2002/05/16 10:07:05 UTC

WSDL2Java: how to manage schema restriction/facets

Hi,

I 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 very well, 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


Re: WSDL2Java: how to manage schema restriction/facets

Posted by dev <de...@chez.com>.
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