Я пытаюсь использовать API почтового пула для получения данных об ошибках.API-интерфейс клиента java
public static ClientResponse GetBounce() {
Client client = new Client();
client.addFilter(new HTTPBasicAuthFilter("api",
"key-XXXXXXXXXXXXXXXXXXXXX"));
WebResource webResource =
client.resource("https://api.mailgun.net/v3/XXXXXXXXXXXX.mailgun.org/" +
"bounces/[email protected]");
return webResource.get(ClientResponse.class);}
Он отлично работает вызов API в порядке, но я не в состоянии преобразовать ClientResponse в соответствующем типе в моем CAE EmailError. Фактический ответ от сервера {"address":"[email protected]","code":"550","error":"550 5.2.1 The email account that you tried to reach is disabled. lq5si9613879igb.63 - gsmtp","created_at":"Tue, 18 Aug 2015 12:23:35 UTC"}
Я создал POJO для отображения ответ
@JsonAutoDetect(getterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
@JsonSerialize(include = Inclusion.NON_NULL)
public class EmailError {
private String address;
private String error;
private String created_at;
//geters...
//setters..
}
И попытаться сопоставить ClientResponse в тип EmailError.
ClientResponse clientResponse = getBounce(email);
EmailError error = response.getEntity(new GenericType<EmailError>() {
});
где clientResponse является объектом возврата методом GetBounce()
It throws an Exception com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class com.che.rt.businessservices.EmailError, and Java type class com.che.rt.businessservices.EmailError, and MIME media type application/json;charset=utf-8 was not found
Любой глазок, где мне не хватает.
Показывайте зависимости. –