well this has been posted a lot of time here but no solution worked for me...
i can avoid this error by making a wrapper class but it only returned
</stringWrapper>
what am i doing wrong ?
StringWrapper class:
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class StringWrapper {
public StringWrapper (){}
List<String> list=new ArrayList<String>();
public void add(String s){
list.add(s);
}
}
code :
@Path("/xml")
@GET
@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
public StringWrapper mystring(){
StringWrapper thestring=new StringWrapper();
thestring.add("a");
thestring.add("a");
return thestring;
}
Java Rest webservice using Jersey.