getEntity().getContent () - Methode HttpResponse nur </ERROR>
Ich habe versucht, eine xml-Antwort durch web service-Aufruf mit Standard httpClient, aber nicht in der Lage, so
als Fehlermeldung kommt in der Antwort.getEntity().getContent().
line String veraible immer kommen, wenn meine Antwort-code 200 kommen.
DefaultHttp-client-Objekt angelegt wird, eine andere Methode
Hier ist mein code--
try {
HttpPost post = new HttpPost(tmsURL);
post.setHeader("Content-Type", "text/xml;charset=utf-8");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair(METHOD_PARAM, method));
nameValuePairs.add(new BasicNameValuePair(XML_PARAM, xml));
UrlEncodedFormEntity entity_st=new UrlEncodedFormEntity(nameValuePairs,"UTF-8");
post.setEntity(entity_st);
HttpResponse response = client.execute(post,localcontext);
responseCode = response.getStatusLine().getStatusCode();
if (responseCode == HttpStatus.SC_OK) {
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("Exception occured in httpClientSendRequest() : "
+ printStackTrace(e));
result = buildXmlErrorMessage("", e.getMessage(), "");
} finally {
//post.releaseConnection();
}
please help me if anybody have any solution to solve the issue
Du musst angemeldet sein, um einen Kommentar abzugeben.
Dein code scheint zu funktionieren gut. Das problem liegt mit Ihrem POST-Anfrage, möchten Sie vielleicht zu prüfen, die Parameter.