Spring RestTemplate
次のような従業員レコードのリストを取得するために使用しようとしています。
public List<Employee> getEmployeesByFirstName(String firstName) {
return restTemplate.getForObject(employeeServiceUrl + "/firstname/{firstName}", List.class, firstName);
}
問題は、Web サービス (呼び出されている) が次の XML 形式を返すことです。
<従業員> <従業員> .... </従業員> <従業員> .... </従業員> </従業員>
したがって、上記の方法を実行すると、次のエラーが発生します。
org.springframework.http.converter.HttpMessageNotReadableException: Could not read [interface java.util.List]; nested exception is org.springframework.oxm.UnmarshallingFailureException: XStream unmarshalling exception; nested exception is com.thoughtworks.xstream.mapper.CannotResolveClassException: **employees : employees**