Closed jerome25000 closed 1 week ago
Hello, I encountered the same issue with the latest Java SDK (8.9.0). The exception occurs when trying to list all conversation messages. For context, I also experienced the same problem with SDK version 8.6.0. Thank you.
Thanks for raising this, will have this fixed in the next patch release.
Fixed in v8.9.1, however please note many read-only events in the API are not currently supported, so you will have to query them manually through the getBody()
method of GenericEvent
, which provides a Map<String, ?>
rather than native data structures. Support for events will be expanded in future releases.
Hello, I am using the latest java SDK (8.9.0) Create a conversation with 2 members. : ok Add simple text message for the 2 members : ok Try to get all conversation : KO
Following java code :
public void listMessages(ConversationsClient client, String roomId) { ListEventsRequest request = ListEventsRequest.builder().eventType(EventType.MESSAGE).build(); ListEventsResponse response = client.listEvents(roomId, request);
Stacktrace Exception in thread "main" com.vonage.client.VonageResponseParseException: Failed to produce ListEventsResponse from JSON. at com.vonage.client.Jsonable.updateFromJson(Jsonable.java:82) at com.vonage.client.Jsonable.fromJson(Jsonable.java:128) at com.vonage.client.DynamicEndpoint.parseResponseSuccess(DynamicEndpoint.java:308) at com.vonage.client.DynamicEndpoint.parseResponse(DynamicEndpoint.java:244) at com.vonage.client.AbstractMethod.execute(AbstractMethod.java:82) at com.vonage.client.conversations.ConversationsClient.listEvents(ConversationsClient.java:363) at com.vonage.client.conversations.ConversationsClient.listEvents(ConversationsClient.java:348) at org.example.VonageConversationManager.listMessages(VonageConversationManager.java:74) at org.example.VonageConversationManager.main(VonageConversationManager.java:105) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type
java.util.ArrayList<com.vonage.client.conversations.Event>
from Object value (tokenJsonToken.START_OBJECT
) at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 30] (through reference chain: com.vonage.client.conversations.ListEventsResponse["_embedded"])The java response is not complient with the java
public final class ListEventsResponse extends HalPageResponse { @JsonProperty("_embedded") private List events;
}
Should have a intermediate object embeded (having a event property) like this :
public final class ListEventsResponse extends HalPageResponse { @JsonProperty("_embedded") Embedded embedded;
}
public class Embedded {
}