Search code examples
postgsonretrofitretrofit2simple-framework

retrofit 2: POST JSON body and XML response


I would like to know if it is posible send a request with a JSON body and get the XML response with retrofit 2.

If I add two .addFactoryConverter() methods retrofit just use the first one for both the request and the response.

Thank you for your help.


Solution

  • With the following code I could solve the problem. https://github.com/square/retrofit/blob/master/samples/src/main/java/com/example/retrofit/JsonAndXmlConverters.java