XML Declaration Tag using SimpleXML
I use Spring for Android to send XML requests, and was facing the same problem. Here's the code to get it work based on @implicit_knowledge's solution in case anyone needs it.
RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); Serializer serializer = new Persister(new Format("<?xml version=\"1.0\" encoding= \"UTF-8\" ?>"));restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter(serializer));restTemplate.postForObject(URL, udata, String.class);