I am using CXF and my bean is as follows
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Test {
@XmlElement(name="id")
protected Long Id;
@XmlElement(name = "students")
protected Set<String> students;
//Getters and setters
}
When i try to use the below request it works
@POST
@Path("/test")
public String getCounts(JAXBElement<Test> jaxFilters) {
Test filter = jaxFilter.getValue();
//Some logic
}
But when i use the below request i am getting 400 error
@POST
@Path("/test")
public String getCounts(JAXBElement<List<Test>> jaxFilters) {
List<Test> filter = jaxFilter.getValue();
//Some logic
}
Can someone help me how to write the Post request to accept for the collection of jaxb beans as body in the post request. Thanks in advance.
Found the solution. Actually in POJO class instead of @XmlRootElement annotated with @XMLType and removed wrapping of JAXBElement in Rest call.