I have clean TommEE Plume and Jdk 1.8. No other libs.

I am trying to serve well formed xml fragment from String.
Like in answer in this article. http://stackoverflow.com/questions/12428727/how-to-marshall-a-string-using-jaxb-that-sometimes-contains-xml-content-and-some
And im getting error:
JAXBException occurred : unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation. unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation.

Response class is similar to Message class in example.
So how to do it? Can i register MOXy for my jaxb or do i have to use jersey or something other?


My service looks like that

@Stateless
@Path("/ap")
public class SimpleGreeting {
    @Path("/")
    @POST
    @Produces("text/xml")
    public Response message3(String q) {
            Response sfq = ap.getSfq(q);
            return sfq;
    }
}

Reply via email to