We are trying to access the Lithium Rest Api (its a https site) through Spring Rest Template as below
           `String plainCreds = lswUserName + ":" + lswPassword;
    byte[] plainCredsBytes = plainCreds.getBytes();
    byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes);
    String base64Creds = new String(base64CredsBytes);
    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization", "Basic " + base64Creds);
    HttpEntity<String> request = new HttpEntity<String>(headers);
        ResponseEntity<String> sRawResp = restTemplate.exchange(completeURL.toString(), HttpMethod.GET, request, String.class);'
Above code always gives
org.springframework.web.client.HttpClientErrorException: 401 Unauthorized Exception
There were no issues when invoking the same web service through postman, however when ever accessed through java code, getting the above 401 unauthorized exception