I've setup up an Oath2 resttemplate client.When it comes back from authenticating with the remote service,it tries to convert the Userinfo from XML to util.Map and dies with
o.s.b.a.s.o.r.UserInfoTokenServices - Could not fetch user details: class org.springframework.web.client.UnknownContentTypeException, Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map] and content type [application/xml;charset=UTF-8]
The XML it receives is like :
"<root><userinfo userid="Userxxx " lastname="xxx" firstname="xxx" /></root>"
I think there are two options :
2.add to resttemplate a converter with setMessageConverters
I don't know if the first is possible. As fas as the second goes I've made an XStream MapEntryConverter but Resttemplate wants a HttpMessageConverter.
And why does by default UserInfoTokenServices require a hashmap? Is there an alternative way ?
Generally you don't have to create your own converters, at least for JSON/XML - Spring will configure them based on the libraries available on the classpath.
For the mentioned formats you usually need the Jackson library. In your case it's the com.fasterxml.jackson.dataformat:jackson-dataformat-xml
dependency.