title: Android, send and receive XML via HTTP POST method
body: <p>There is a relevant question, but I could not get the answer clearly.</p>
  
  <p>I would like to POST a short xml code</p>
  
  <pre><code>&lt;aaaLogin inName="admin" inPassword="admin123"/&gt;
  </code></pre>
  
  <p>to a specific URL address over HTTP. The Web service will send me back a XML code. The important part is that I will parse the received XML, and I want to store that as a file.</p>
  
  <pre class="lang-java prettyprint-override"><code>    // Create a new HttpClient and Post Header  
      HttpClient httpclient = new DefaultHttpClient();  
      HttpPost httppost = new HttpPost("http://192.168.192.131/"); //URL address
  
      StringEntity se = new StringEntity("&lt;aaaLogin inName=\"admin\" inPassword=\"admin123\"/&gt;",HTTP.UTF_8); //XML as a string
      se.setContentType("text/xml"); //declare it as XML
      httppost.setHeader("Content-Type","application/soap+xml;charset=UTF-8");
      httppost.setEntity(se);
  
      BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient .execute(httppost);
      tvData.setText(httpResponse.getStatusLine().toString()); //text view is expected to print the response
  </code></pre>
  
  <p>there is something wrong with receiving the response. Besides, I did not write anything to save the received XML as a file. Can someone write a code snippet?</p>