My web service is working and I can print out the XML retrieved by the Service with my code below:
resource = client.resource("http://localhost:8080/testProject/rest/items");
ClientResponse response= resource.get(ClientResponse.class);
String entity = response.getEntity(String.class);
System.out.println(entity);
However I'm trying to now use this XML to be the data provider for a JTable, and I can't work out how to parse it. My code is below but won't work because "entity" is a string.
JAXBContext context = JAXBContext.newInstance(Item.class);
Unmarshaller um = context.createUnmarshaller();
Item item = (Item) um.unmarshal(entity);
So my question(s) are
What am I doing wrong here?
Should I not be using .getEntity(String.Class) to do this?
Is there an easier way to get this XML response into a JTable?
Thanks