POST Request Works in Postman but not properly with RestTemplate - SpringBoot

Viewed 261

I'm using RestTemplate to get the response body was encrypted or else not properly showing (it's working properly till yesterday, but today this problem occurred without changing any code). But when I hit the API in Postman it's getting the proper response body (in XML type content).

I have no idea for this issue because that code worked properly till yesterday.

Why does this happen? And how does Postman show proper response and RestTemplate showing another type?

Note: attach image for your refernce

My code:

String xml = jaxbObjectToXML(createSRINTOSSet);
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();

// create headers
headers.add("MAXAUTH", auth);
headers.setContentType(MediaType.TEXT_PLAIN);

try {
    HttpEntity<String> request = new HttpEntity<String>(xml, headers);
    response = restTemplate.postForEntity(maximoIntegrationURI, request, String.class);
0 Answers
Related