HttpHeaders reqheaders= new HttpHeaders();
reqheaders.set(HttpHeaders.Accept,MediaType.Application_xml)
reqheaders.set(HttpHeaders.Content_type,MediaType.Application Json)
HttpEntity XML= new HttpEntity (json,reqheaders)
ResponseEntity<Map> xmlfile= restTemplate.exchange(url,HttpMethod.POST,XML, Map.class)
I am getting no suitable HttpMessageConverter found for response type[interface java.util.Map] and content type [application/xml;charset=UTF-8]
it looks like no suitable
HttpMessageConverter
is registered with the RestTemplate can convertxml
content to a Map object.There some
HttpMessageConverters
which are pre-enabled and can be checked here. You need to make sure that the suitableHttpMessageConverter
is on your classpath.