I am trying to make my @webparam
mandatory using (@XmlElement(required=true)
but the generated XSD still shows this as minOccurs="0"
. Also tried setting nillable=false
but still not working.
Here is my web method :
@WebMethod
@WebResult(name = "Biller")
public Biller getBiller(@XmlElement(required=true) @WebParam(name = "billerId") Integer billerId){}
Please suggest.
As specified by me in comments - either you need to wrap your Integer
variable into some Java POJO and apply rules for specific fields in that POJO or change to primitive type because - reference types are always optional but constituent fields of wrapper types can be made required or optional.
Primitive types are always required.
Then comes the question about default values - and for that refer Answers to this question and summary is - if nothing is specified -
minOccurs and maxOccurs default to 1
Now why your call succeeds with SOAP UI - Your xsd is correct and that is acknowledged by SOAP UI so my guess is client might be attaching some default values when its missing. I haven't used SOAP UI. Try examining your request ans see if value is really missing. If value is indeed missing in request then try to examine as why validation is not kicking in.