Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
Possible duplicate of stackoverflow.com/questions/10909482/… – Alex Stybaev Jun 28 at 9:44
that solution isnt working !! – user2416728 Jun 28 at 9:52
really? Even this one: stackoverflow.com/a/14645979/1235336 ? – Alex Stybaev Jun 28 at 11:09
yes............. – user2416728 Jun 28 at 11:17
show 1 more commentadd comment (requires an account with 50 reputation)

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.