public InputStream postXML(String url, final String
xml) {
HttpPost post = new HttpPost( url);
InputStream inStream = null;
ContentProducer cp = new ContentProducer() {
public void writeTo(OutputStream outstream) throws IOException {
Writer writer = new OutputStreamWriter(outstream, "UTF-8");
writer.write( xml);
writer.flush();
}
};
post.setEntity(new EntityTemplate( cp));
try {
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
inStream = response.getEntity().getContent();
return inStream;
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
HttpPost post = new HttpPost( url);
InputStream inStream = null;
ContentProducer cp = new ContentProducer() {
public void writeTo(OutputStream outstream) throws IOException {
Writer writer = new OutputStreamWriter(outstream, "UTF-8");
writer.write( xml);
writer.flush();
}
};
post.setEntity(new EntityTemplate( cp));
try {
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
inStream = response.getEntity().getContent();
return inStream;
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}