Jersey Client - Getting Response from a Get service returning collection of Dto's


Trying to do something like this 


List<SampleDto> sampleDtoList = target("/samleService/getService/input/123").request(MediaType.APPLICATION_XML).get(List.class);

where SampleDto is the XML annotated entity. The above code won't work as there is no reference to the annotated entity and hence unmarshelling won't happen  and it will throw the following exception

org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=application/xml, type=interface java.util.List, genericType=interface java.util.List.

Resolution -

List<SampleDto> sampleDtoList = target("/samleService/getService/input/123").request(MediaType.APPLICATION_XML).get(new GenericType<List<ReturnCompletionDto>>(){});