Why requesting a restful service with accept header set to application/xml is returning a Json representation?, in this application in this repository wildfly / quickstart / helloworld-rs
The @Produces({ "application/json" })
indicates it only produces JSON. If you were to change it to @Produces({ "application/json", "application/xml" })
then it should work.