简体   繁体   中英

JAX-WS and XSD Validation

I have a wsdl that has a imported xsd, this xsd has quite a restrictions like this:

<xsd:simpleType name="len_type">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value='[:alnum:]{4} [\d]{2} [\d] [\d]{2}' />
    </xsd:restriction>
</xsd:simpleType>

So I would thind that when I deploy this ear to glassfish via netbeans that there would be validation done on the data that is passed in, but this is not the case. Is there any calls I need to make to ensure that the data is validated before it is passed to my @WebService object and turned into a Java object.

Use the SchemaValidation annotation.

Be forewarned, that it works only for web services of document/literal style. And be careful about schema validation, if you are using XSD imports .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM