开发者

Send xml files in android with http post

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 para开发者_StackOverflowmeters which are username and password. Please send me code suggestions :-) thanks


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜