UserService { @Path("/list") @GET public List<User> list(@QueryParam("first") @DefaultValue("0") int first, @QueryParam("max") @DefaultValue("20") int max) { List<User> users = new ArrayList<User>(); List<User> found = em.createNamedQuery("user.list", User.class).setFirstResult(first).setMaxResults(max).getResultList(); for (User u : found) { users.add(u.copy()); } return users; }  @Path("/create") @PUT User create(@QueryParam("name") String name,
                       @QueryParam("pwd") String pwd,
                       @QueryParam("mail") String mail); @Path("/list") @GET List<User> list(@QueryParam("first") @DefaultValue("0") int first,
                           @QueryParam("max") @DefaultValue("20") int max); @Path("/show/{id}") @GET User find(@PathParam("id") long id); @Path("/delete/{id}") @DELETE void delete(@PathParam("id") long id); @Path("/update/{id}") @POST Response update(@PathParam("id") long id,
                           @QueryParam("name") String name,
                           @QueryParam("pwd") String pwd,
                           @QueryParam("mail") String mail);  }
@Test public void list() throws Exception { String users = WebClient.create("http: .path("/user/list") .get(String.class); assertEquals( inline("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<users>" + " <user>" + " <email>foo@foo.com</email>" + " <fullname>foo</fullname>" + " <id>1</id>" + " <password>foopwd</password>" + " </user>" + " <user>" + " <email>bar@bar.com</email>" + " <fullname>bar</fullname>" + " <id>2</id>" + " <password>barpwd</password>" + " </user>" + "</users>"), inline(users)); }