1

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

Micah Hainline
  • 14,367
  • 9
  • 52
  • 85
Mark Larson
  • 11
  • 2
  • 3

2 Answers2

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 ;)

Community
  • 1
  • 1
Bill Mote
  • 12,644
  • 7
  • 58
  • 82
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