如何解决使用jersey客户端发送原始XML?
|String xmlString = \"<a>test</a>
WebResource resource = Client.create().resource(\"http://somehost.com\")
resource.put(ClientResponse.class,xmlString)
上面的东西怎么工作?我没有在另一侧获得application / xml标头的内容类型。
解决方法
更新
您可以执行以下操作:
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);