Reputation: 21
I'm developing webservices with jaxws, so I generate wsdl and xsd files from annotated java classes via wsgen.
I'm searching for possibility 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?
Upvotes: 2
Views: 929
Reputation: 403481
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.
Upvotes: 2