Sending post xml to REST

BloodyChef

New Member
I'm developing an Android application which sends content to a server using rest web services.With simple parameters (strings, int, ...) it works great, but know I would like to send some objects and I'm trying to do it sending the XML form of the object to the server through a POST petition. But I'm receiving a 415 code ("Unsupported Media Type"), and I don't know what could be. I know the xml is OK because with the POSTER plugin of firefox you can send post data to the web service and it responds ok, but through the Android I am not able to do it.Here is the code I'm using:\[code\]ArrayList<NameValuePair>() params = new ArrayList<NameValuePair>();params.add(new BasicNameValuePair("customer", "<customer> <name>Bill Adama</name> <address>lasdfasfasf</address></customer>");HttpPost request = new HttpPost(url); request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));HttpClient client = new DefaultHttpClient(); HttpResponse httpResponse = client.execute(request);\[/code\]Any hint? I dont really know what is going on. Maybe do I need to specify anything in the header http because I send an xml? Remember: with simple data it works fine.
 
Back
Top