@POST @Consumes(MediaType.APPLICATION_XML) @Path("/{id}/kommentare") public void createKommentar(@PathParam("id") int id, Kommentar src) throws JAXBException, FileNotFoundException { Spiele spiele = (Spiele) XmlTools.unmarshal(Spiele.class); src.setId(XmlTools.getNextKommentarId(id)); for (Spiel s : spiele.getSpiel()) { // Spiel, zu dem der Kommentar gehört if (s.getId().intValue() == id) { s.getKommentare().getKommentar().add(src); XmlTools.marshal(Spiele.class, spiele); throw new WebApplicationException(Response.Status.CREATED); } } throw new WebApplicationException(Response.Status.NOT_FOUND); }