What's the purpose of minOccurs, nillable and restriction?

后端 未结 5 1800
故里飘歌
故里飘歌 2021-02-02 13:44

Documentation for required says:

If required() is true, then Javabean property is mapped to an XML schema ele

5条回答
  •  猫巷女王i
    2021-02-02 14:27

    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;
    
        //...
    }
    

提交回复
热议问题