开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜