I'm using RESTEasy 2.2.1.GA, and trying to write a client to connect to a third part service. I've gone over the documentation a few times, but I'm just not grok'ing some portion of the process.
So I created an interface to proxy.
@Path("service")
public interface SchoolSearch {
@GET
@Produces({MediaType.APPLICATION_XML})
@DoNotUseJAXBProvider
ClientResponse<SchoolType> getSchoolsByZipCode(@QueryParam("postalcode") int postalCode);
}
The actual client call:
public Collection<SchoolType> getSchools() {
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
Collection<SchoolType> schools = new ArrayList<SchoolType>();
SchoolSearch service = ProxyFactory.create(SchoolSearch.class, SITE_URL);
ClientResponse<SchoolType> response = service.getSchoolsByZipCode(35803);
return schools;
}
When I run my tests for this call, the exceptions seem to be consumed quietly (not sure I understand why this is occurring, but guessing I missed the discussion in the docs, not germane anyway) Anyway, when I dig into response.getEntity() during execution I see:
Unable to find a MessageBodyReader of content-type text/html;charset="UTF-8" and type class generated.SchoolType
From reading about the MIME types and looking at table 45.2 in the documentation, it seems pretty obvious that when the Response is returned, RESTEasy wants to try and handle it automatically, but doesn't know which MessageBodyReader to use.
So my question, given the situation, what is the best approach to resolve this situation? Is there a simple way to say "no really, this is application/xml", or will I need to implement a custom MessageBodyReader?
I apologize if this has been covered before, but I'm just not getting it.
Thanks all.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using RESTEasy 2.2.1.GA, and trying to write a client to connect to a third part service. I've gone over the documentation a few times, but I'm just not grok'ing some portion of the process.
So I created an interface to proxy.
The actual client call:
When I run my tests for this call, the exceptions seem to be consumed quietly (not sure I understand why this is occurring, but guessing I missed the discussion in the docs, not germane anyway) Anyway, when I dig into response.getEntity() during execution I see:
From reading about the MIME types and looking at table 45.2 in the documentation, it seems pretty obvious that when the Response is returned, RESTEasy wants to try and handle it automatically, but doesn't know which MessageBodyReader to use.
So my question, given the situation, what is the best approach to resolve this situation? Is there a simple way to say "no really, this is application/xml", or will I need to implement a custom MessageBodyReader?
I apologize if this has been covered before, but I'm just not getting it.
Thanks all.