我有服务女巫在正文中返回相当简单的XML,但在" ns中有非常大的文本:响应"标签 - 在IE / Chrome中约为。 40kB,但在HttpClient中我得到了:
<ns:InvokeResponse xmlns:ns="...">
<ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns:ServiceResponse">
<ns:responses>TOO MANY CHARACTERS</ns:responses>
<ns:returnCode>0</ns:returnCode>
</ns:return>
</ns:InvokeResponse>
我正在使用HttpClient示例中的代码:
CloseableHttpClient httpclient = HttpClients.createMinimal();
try {
HttpGet httpGet = new HttpGet(request);
CloseableHttpResponse response1 = httpclient.execute(httpGet);
try {
System.out.println(response1.getStatusLine());
HttpEntity entity1 = response1.getEntity();
entity1.writeTo(new FileOutputStream("out.txt"));
EntityUtils.consume(entity1);
} finally {
response1.close();
}
} finally {
httpclient.close();
}
知道如何改进库可以正确读取一个标签中的大块字符,以便我有正确的数据,而不是“很多字符”?
答案 0 :(得分:0)
应用程序/库很好。这是URL中的错误,答案是来自服务器的正确答案。