We are using Spring-Integration in our project. I am experiencing a weird problem with http:outbound-gateway
. We need to pass the following headers for executing a rest service.
1)Accept=application/vnd.dsths.services-v1+xml
2)Content-Type=application/xml
The weird part is that the response returned is not always unique, In dev environment, xml response(Content-Type=application/vnd.dsths.services-v1+xml
) is returned while in client environment, json response(Content-Type=application/vnd.dsths.services-v1+json
) is returned. I have verified the log files by turning on DEBUG
and found that the org.springframework.web.client.RestTemplate
is Setting request Accept header to [text/plain, application/json, application/*+json, */` * ].
2017-07-10 16:17:11,563 DEBUG [org.springframework.web.client.RestTemplate] (ajp-/10.226.55.163:8009-1) Setting request Accept header to [text/plain, application/json, application/*+json, */*]
I could able to overcome this problem by overriding the value of accept=*/*
to accept=application/vnd.dsths.services-v1+xml
in the client environment(Please note that this header is not the actual "Accept
" header).
The question here is why http:outbound-gateway
is behaving oddly and manipulating the header value? Why the Spring Integration is not able to identify the difference between the headers and "accept"
and "Accept"
? Is my fix correct one?