开发者

Possibility of validation of required parameters?

开发者 https://www.devze.com 2023-02-19 18:18 出处:网络
I\'m developing webservices with jaxws, so I generate wsdl and xsd files from annotated java classes via wsgen.

I'm developing webservices with jaxws, so I generate wsdl and xsd files from annotated java classes via wsgen. I'm searching for po开发者_如何学运维ssibility of automatic validation of parameters which are marked as required via the annotation @XmlElement(required = true) on the server-side.

All that I found is @SchemaValidation. But that doesn't fit the problem.

The documentation of that class says: "Validates all request and response messages payload(SOAP:Body) for a WebService against the XML schema."

But clearly that doesn't include a required checking.

Any idea?


In standard JAXB, the required attribute of XmlElement is only used when generating XML Schema documents from your code. It is not used at runtime for data validation.

If you want to perform declarative data validation, you need to use schema validation. I'm not sure why you're resisting that - it's much more powerful than any java-based constraints can be.

0

精彩评论

暂无评论...
验证码 换一张
取 消