1

I'm using Retrofit2 as REST client and SimpleXmlConverterFactory for converting from Java to xml, and from xml to Java object.

When I send response with NotificationResponse through REST, no one of the anotations seem to be applied.

@Root(name = "response")
public class NotificationResponse {
    @Element(name="message")
    private String msg;
    @Element(name="version")
    private String ver;
}

Instead of :

<response>
    <message>Hello</message>
    <version>1</version>
</response>

I'm sending:

<NotificationResponse>
<msg>Hello</msg>
<ver>1</ver>
</NotificationResponse>

Any idea, why @Root and @Element are ignored?

0 Answers0