gpt4 book ai didi

java - 使用 Jersey 客户端发送原始 XML?

转载 作者:行者123 更新时间:2023-11-30 11:53:45 24 4
gpt4 key购买 nike

String xmlString = "<a>test</a>
WebResource resource = Client.create().resource("http://somehost.com")
resource.put(ClientResponse.class, xmlString)

上面的东西如何工作?我没有在另一端获得应用程序/xml header 的内容类型。

最佳答案

更新

您可以为看跌期权执行以下操作:

WebResource resource = Client.create().resource("http://somehost.com");
ClientResponse response = resource.type("application/xml").put(ClientResponse.class, "<a>test</a>");

您可以执行以下操作:

WebResource resource = Client.create().resource("http://somehost.com");
ClientResponse response = resource.accept("application/xml").get(ClientResponse.class);

关于java - 使用 Jersey 客户端发送原始 XML?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6125837/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com