I have created a webservice using Java, Spring, CXF. The webservice returns POJO which has been annotated with XmlRootElement(name = “LeaveRecord”). This POJO has fields and the getters are annotated with @XmlAttribute. Is there a way to define (through annotation I expect?) what values can be expected for this field (eg. the status field may return APPROVED, PENDING or DECLINED) and I would hope these expected values would pull through to the WSDL when it gets created so that clients wanting to use this webservice could know beforehand what values to expect?
I have created a webservice using Java, Spring, CXF. The webservice returns POJO which
Share
I think you should consider coding those expected values as Enums. That way you have total control over values of those fields: