我想发送邮件消息到身份验证服务器,我正在使用postforobject。当我运行该程序,我得到“在线程异常‘主要’org.springframework.web.client.HttpClientErrorException:401空”错误RestTemplate postForObject返回HttpClientErrorException:401 null
RestTemplate rest = new RestTemplate();
String responseEntity;
String uri = "http://...";
responseEntity = rest.postForObject(uri, null, String.class);
System.out.println(responseEntity);
我也试过
responseEntity = rest.postForObject(uri, "", String.class);
同样的结果,它没有工作。
当我使用简单的REST客户端它的工作原理 enter image description here
任何想法?
你试过一个空字符串而不是null吗? –
是的,我尝试过。它没有工作 – Sefa
你如何发送认证参数? – Coder