项目场景:
resttemplate调用HttpEntity 产生报错
传输过程
问题描述:
org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter found for request type [[Lorg.apache.commons.httpclient.NameValuePair;] and content type [application/x-www-form-urlencoded]
原因分析:
HashMap<String, String> map = new HashMap<>(); map.put("xmlData", "xmlDataInfo"); //上面的map直接塞进request请求里会报错 /** * org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter * found for request type [[Lorg.apache.commons.httpclient.NameValuePair;] and content type [application/x-www-form-urlencoded */ //应该把map换成NameValuePair[] data = { new NameValuePair("x