Good evening.

I make one small servich and an unsolvable and, most importantly, incomprehensible question appeared for me. There is an API that is located at: http://domen.com/API/XML/APIManager.ashx

The documentation says that you need to send a request with the header: GetMethod and content:

<Request> <Header> <Authentication> <Login>string(32)</Login> <Pass>string(14)</Pass> </Authentication> <Request>int</Request> </Header> </Request> 

How to implement such a request for Android to get a response from the server?

Thank you very much!

  • @ilyarasputin, If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina

1 answer 1

 HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(<YOUR_URL_HERE>); try { StringEntity se = new StringEntity( <YOUR_XML_HERE>, HTTP.UTF_8); se.setContentType("text/xml"); httppost.setEntity(se); HttpResponse httpresponse = httpclient.execute(httppost); HttpEntity resEntity = httpresponse.getEntity(); String responseString = EntityUtils.toString(resEntity)); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } 

Also do not forget that working with the network in the main stream is prohibited .