en.......
I write a simpleType called "intRange"

            <xsd:simpleType name="intRange">
                <xsd:restriction base="xsd:integer">
                    <xsd:minInclusive value="0"/>
                    <xsd:maxInclusive value="120"/>
                </xsd:restriction>
            </xsd:simpleType>

wsdl2java will produce a java class called IntRange.java skeleton (for
server, not for client) , which has a method setIntRange(),

    public void setIntRange(java.math.BigInteger param) {

        if (org.apache.axis2.databinding.utils.ConverterUtil.compare(param,
                "120") <= 0) {
            this.localIntRange = param;
        } else {
            throw new java.lang.RuntimeException();
        }

        if (org.apache.axis2.databinding.utils.ConverterUtil
                .compare(param, "0") >= 0) {
            this.localIntRange = param;
        } else {
            throw new java.lang.RuntimeException();
        }

    }

then I send a soap request with  <intRange>1400</intRange>, the axis server
will throw an exception.

So, I think axis2 adb enforces the restrictions.

Is there something wrong about what I think ?

---Xuepeng

2010/4/21 Doughty, Michael <[email protected]>

> As I understand it, some examples of this would be the following:
>
> (1)  Length restrictions on Strings:
>
> <xs:element name="password">
>   <xs:simpleType>
>     <xs:restriction base="xs:string">
>       <xs:length value="8"/>
>     </xs:restriction>
>   </xs:simpleType>
> </xs:element>
>
> (2)  Minimum and maximum length on Strings:
>
> <xs:element name="password">
>  <xs:simpleType>
>    <xs:restriction base="xs:string">
>      <xs:minLength value="5"/>
>      <xs:maxLength value="8"/>
>    </xs:restriction>
>  </xs:simpleType>
> </xs:element>
>
> (3)  Pattern restrictions on Strings:
>
> <xs:element name="letter">
>   <xs:simpleType>
>     <xs:restriction base="xs:string">
>       <xs:pattern value="[a-z]"/>
>     </xs:restriction>
>   </xs:simpleType>
> </xs:element>
>
> (4) Minimum and maximum value restraints on Integers:
>
> <xs:element name="age">
>  <xs:simpleType>
>    <xs:restriction base="xs:integer">
>      <xs:minInclusive value="0"/>
>      <xs:maxInclusive value="120"/>
>    </xs:restriction>
>  </xs:simpleType>
> </xs:element>
>
> I don't believe Axis2 will fail to process at wsdl2java time.  It will
> still build stubs from these.  What it won't do is actually encapsulate the
> restrictions into the data types, so none of the restrictions will actually
> be enforced at runtime.
>
> There is one case though that I believe ADB bindings will allow for, and
> that is the specified value restrictions:
>
> <xs:element name="car">
>  <xs:simpleType>
>    <xs:restriction base="xs:string">
>      <xs:enumeration value="Audi"/>
>      <xs:enumeration value="Golf"/>
>      <xs:enumeration value="BMW"/>
>    </xs:restriction>
>  </xs:simpleType>
> </xs:element>
>
> I believe these will be properly encapsulated into an enumeration type.
>
> Keep in mind that the restrictions are for ADB bindings.  If you want to
> use and enforce any of those restrictions that ADB bindings won't handle,
> Axis2 does support XML Bean bindings, which I believe will enforce those
> restrictions.
>
> (Note:  these examples were all taken from
> http://www.w3schools.com/schema/schema_facets.asp )
>
> ----------------------------------------
>
> From: Xuepeng Li [mailto:[email protected]]
> Sent: Wednesday, April 21, 2010 5:20 AM
> To: [email protected]
> Subject: could some one give me a xml schema example that axis2 can't
> process ?
>
> hi all
>     In Axis2 document , i find adb binding "It is not meant to be a full
> schema binding application, and has difficulty with structures such as XML
> Schema element extensions and restrictions."  but i don't know what the
> limition is.
>     could some one give me a xml schema example that axis2 can't process ?
>
> thanks very much~
>

Reply via email to