Documentation for required says:
If
required()
istrue
, then Javabean property is mapped to an XML schema ele
The purposes of required
and minOccurs
aren't mislead, the problem is that the schema validation is not enabled. Just enable SchemaValidation
to the WebService
and define the order of the XmlType
's mapping as follows:
Web Service:
@javax.jws.WebService
@org.jboss.ws.annotation.SchemaValidation(enabled = true)
public class WebServiceClass {
@javax.jws.WebMethod
public WSResponseData webServiceMethod() {
//...
}
}
XmlType:
@javax.xml.bind.annotation.XmlType(propOrder = {"field1", "field2", "field3"})
public class WSData {
//...
private String field1;
private Long field2;
private XmlMonthType field3;
//...
}