Мой код:
Код: Выделить всё
@RequestMapping(value = "/hookslistner", method = RequestMethod.POST)
public ResponseEntity recieveWebhook(@RequestBody InventorySystemModel inventory,
@RequestHeader("event") String event,
@RequestHeader("Authorization") String authorization) {
// authorization = "Basic "
RestTemplate restTemplate = new RestTemplate();
org.springframework.http.HttpHeaders httpHeaders = new org.springframework.http.HttpHeaders();
String url = "https://prod-01.centralindia.logic.azure.com/workflows/835348";
String headerName = "Authorization";
httpHeaders.add(headerName, authorization);
httpHeaders.add("Content-Type", "application/json");
HttpEntity requestEntity = new HttpEntity("Headers", httpHeaders);
System.out.println(">>>>>>>" + restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class).getBody());
}
Код: Выделить всё
SEVERE: Servlet.service() for servlet [webhooks] in context with path [/inventoryhooks] threw exception [Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorException: 401 Unauthorized] with root cause
org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
.
.
.
Может ли кто-нибудь указать мне, что такое что-то не так?
Подробнее здесь: https://stackoverflow.com/questions/459 ... horization