I want to know if anyone knows a good tutorial. I have in my app 2 edittexts with username and password. I want to write these in an xml file and send it to my server. I was thinking about a function which opens the connection, writes the xml, sends it, and waits for an answer, and this function will have two input parameters which are username and password. Please send me code suggestions :-) thanks
Asked
Active
Viewed 4,473 times
2 Answers
1
Your question has been asked before: Android, sending XML via HTTP POST (SOAP) A simple google search of: android http post xml returned that result, of course SO has a search feature too ;)
1
What you want to look at is the HttpClient
class. You'll probably want to do something like this:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://www.example.com/myscript");
HttpResponse response = httpClient .execute(httpPost );
And add your data using httppost.setEntity
. There are plenty of code examples out there for this type of thing. A simple Google search should yield tons of information for you.

Joe Krill
- 1,734
- 1
- 18
- 19
-
hey Joe maybe u can post an example with full code..i will be very thankfull – Mark Larson Apr 08 '11 at 14:44