【发布时间】:2014-03-27 08:10:48
【问题描述】:
我正在尝试获取 java.util.List 作为来自 cxf REST Web 服务的响应。 我尝试过使用 WebClient 类的方法 postObjectGetCollection 方法,但没有运气。 我收到 - org.apache.cxf.jaxrs.client.ClientWebApplicationException: .No message body reader has found for class : interface java.util.Collection, ContentType : application/json.
以下是我的客户端代码-
String mediaType = "application/json";
if (url != null) {
List<DataTypeDTO> resultdtos = new ArrayList<DataTypeDTO>();
WebClient client = WebClient.create(url);
client = client.accept(mediaType).type(mediaType).path(uri);
resultdtos = (List<DataTypeDTO>)client.getCollection(DataTypeDTO.class);
System.out.println(resultdtos);
}
如果我缺少任何配置或其他内容,请帮助我。
【问题讨论】:
标签: web-services rest cxf cxfrs