How to host an XML file using a Jersey REST client

I want to send an XML file and get a response as an XML file. The code I'm trying to make is excluded, please someone can help. I'm not sure what is going wrong here.

ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); String response = service.type(MediaType.APPLICATION_XML).accept(MediaType.TEXT_XML).post(String.class, new File("post.xml")); System.out.println(response); 
+7
jersey
source share
1 answer

try

 ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); String response = service.type(MediaType.APPLICATION_XML) .accept(MediaType.TEXT_XML) .entity(new File("post.xml")) .post(String.class); System.out.println(response); 
+8
source share

All Articles