hallo everyone i'm trying to create a restful client which will receive xml from a server. I'm using the restTemplate.exchange() for the interaction with the server. The problem is that i'm taking a RestClientException and the message which appears says: "Could not extract response: no suitable HttpMessageConverter found for response type [model.Registration] and content type [application/xml]". So i decide to add in the dispatcher servlet the followings lines of code:
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate ">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.xml.Sour ceHttpMessageConverter"/>
</list>
</property>
</bean>
and in the controller i declare the restTemplate as following:
@Autowired
private RestTemplate restTemplate = new RestTemplate();
and because this didn't work i used:
@Inject annotation.
Both of them doesn't work, so it seems that the problem is something else.
If anyone of you faced or knows how to solve this problem, please give me
some instructions. I want directions on what to look.
P.S.
I tried some moths ago when i start to work with Spring, to retrieve xml data
from a server and was succesful.I remember that i didn't add anything special
just use the JAXB annotations and thats it. Now the situation is different and i
don't know why.


Reply With Quote
