【发布时间】:2017-02-22 20:00:32
【问题描述】:
我有网络服务网址:
http://myservice.local/aprovalanduser/?format=json&Name=India
当我使用
调用此 URL 时resttemplate httpsrestTemplate.getForObject(uri, userdetails[].class)
我收到错误:
org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
在网络服务方法中:
method: "GET",
data: xmlData,
contentType: "application/xml",
dataType: "xml",
async: true,
crossDomain: false,
我只为 XML 设置标题,如下所示:
headers.setContentType(MediaType.APPLICATION_XML);
【问题讨论】:
标签: spring spring-security spring-boot