manoj wrote:
> Hi friends,
> I want to send the some xml data to server. Here I am showing you the
> example I tried:
> try
> {
> String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
> +"<name>Manoj</name>\n"
> +"<number>123</number>\n"
> +"<school>dmh</school>\n";
> String url = "http://localhost:9090/loggerapi.php?data="+s;
> HttpClient httpclient = new DefaultHttpClient();
> HttpPost httpPost = new HttpPost(URI.create(url));
> httpPost.setHeader("Content-type","text/xml; charset=ISO-8859-1");
> ResponseHandler<String> responseHandler = new BasicResponseHandler();
> String responseBody = httpclient.execute(httpPost, responseHandler);
> }
>
> catch(Exception e)
> {
> e.printstackTrace();
> }
>
> I am getting the exception as
> java.lang.IllegalArgumentException: Illegal character in query at
> index 41:
> <name>Manoj</name>
> <number>123</number>
> <school>dmh</school>
> can any one please help me how to solve this problem (sending the xml
> file to server)?
http://hc.apache.org/httpcomponents-client/examples.html
Notably:
-- You don't normally construct POST requests with parameters in the URL
-- If you do, you have to URL-encode the URL parameters
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---