Send raw XML using jersey client?
String xmlString = "<a>test</a>
WebResource resource = Client.create().resource("http://somehost.com")
resource.put(ClientResponse.class, xmlString)
Ho开发者_运维技巧w can something like the above work? I am not getting content-type of application/xml header on the other side.
UPDATE
You could do the following for a put:
WebResource resource = Client.create().resource("http://somehost.com");
ClientResponse response = resource.type("application/xml").put(ClientResponse.class, "<a>test</a>");
You could do the following for a get:
WebResource resource = Client.create().resource("http://somehost.com");
ClientResponse response = resource.accept("application/xml").get(ClientResponse.class);
精彩评论