Content type 'application/xml;charset=UTF-8' not supported
时间: 2023-10-15 17:23:54 浏览: 256
php原生导出excel文件的两种方法(推荐)
"Content type 'application/xml;charset=UTF-8' not supported"报错表示请求的内容类型不被支持。根据引用和引用的信息,可以看出,在发送POST请求时,使用了错误的内容类型。根据引用中的正确示例,可以通过设置正确的请求头来解决这个问题。正确的做法是设置请求头的Content-Type为"application/json;charset=UTF-8",并将其添加到HttpHeaders中,然后将HttpHeaders对象作为参数传递给HttpEntity。最后,将HttpEntity作为参数传递给restTemplate.postForObject方法来发送请求。这样就可以正确地发送POST请求并得到预期的响应数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [restTemplat发post请求报错Content type ‘application/xml;charset=UTF-8‘ not supported](https://blog.csdn.net/baidu_21349635/article/details/120756529)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [RestTemplate远程调用报错:Content type ‘application/xml;charset=UTF-8‘ not supported](https://blog.csdn.net/manba_out/article/details/121022258)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文