JAX-WS 和 XSD 验证 [英] JAX-WS and XSD Validation

查看:48
本文介绍了JAX-WS 和 XSD 验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 wsdl,它有一个导入的 xsd,这个 xsd 有很多这样的限制:

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>

所以我认为当我通过 netbeans 将这个耳朵部署到 glassfish 时,将对传入的数据进行验证,但事实并非如此.在将数据传递给我的 @WebService 对象并转换为 Java 对象之前,是否需要进行任何调用以确保数据经过验证.

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.

推荐答案

使用 SchemaValidation 注释.

预先警告,它仅适用于文档/文字样式的 Web 服务.如果您使用 XSD 导入,请注意架构验证.

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.

这篇关于JAX-WS 和 XSD 验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆