java - POST xml file using http request on Android -


i'm trying post following xml server url, don't know how go it. requests easy enough, i'm having problem post requests.

<?xml version="1.0" encoding="utf-16"?> <arrayofstring xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"  xmlns:xsd="http://www.w3.org/2001/xmlschema"> <string>the_command</string> </arrayofstring> 

i need able modify 'the_command' @ run-time before making request. appreciated!!!!

you can try 1 -

stringbuilder sb = new stringbuilder();  sb.append("<arrayofstring>"); sb.append("<string>").sb.append("the_command").sb.append("</string>"); sb.append("</arrayofstring>");  stringentity entity = new stringentity(sb.tostring(), "utf-8"); httppost.setentity(entity);   httppost.addheader("accept", "application/xml"); httppost.addheader("content-type", "application/xml");  httpresponse response = httpclient.execute(httppost);  

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -