I am using jersey, and I want to send (in a POST) a list of objects to the server. This is the scenario:
@XmlRootElement
class Myclass{
//some primitive attributes + empty constructor + getter/setters
}
MyClass is both on server and client side.
@XmlRootElement
class MyClasses{
private List classes = new ArrayList();
// put some MyClass into the list
}
class Sender{
MyClasses list = new MyClasses();
// after client initialization i want to send this list in a POST to server
WebResource service = client.resource(baseURI());
//I tried
service.type("application/xml").accept("application/xml").post(ClientResponse.class,list);
}
//on server side @path("/tosend")
class receiver{
public Response posted(JAXBElement vals){
//work with vals.getValue() as the list of all Objects
}
}
Unfortunately, I have this error : ContainerRequest getEntity : A Message body reader for JAXBElement and JAXBElement and MIME Type application/octet-stream was not found.
How can I fix that?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)