I am using retrofit 2.0.0-beta1 with SimpleXml. I want to get a simple (XML) resource from a REST service. Marshalling / Unmarshalling a simple object with SimpleXML works great.
When using this code (converted pre 2.0.0 format):
final Retrofit rest = new Retrofit.Builder() .addConverterFactory(SimpleXmlConverterFactory.create()) .baseUrl(endpoint) .build(); SimpleService service = rest.create(SimpleService.class); LOG.info(service.getSimple("572642"));
Services:
public interface SimpleService { @GET("/simple/{id}") Simple getSimple(@Path("id") String id); }
I get this exception:
Exception in thread "main" java.lang.IllegalArgumentException: Unable to create call adapter for class example.Simple for method SimpleService.getSimple at retrofit.Utils.methodError(Utils.java:201) at retrofit.MethodHandler.createCallAdapter(MethodHandler.java:51) at retrofit.MethodHandler.create(MethodHandler.java:30) at retrofit.Retrofit.loadMethodHandler(Retrofit.java:138) at retrofit.Retrofit$1.invoke(Retrofit.java:127) at com.sun.proxy.$Proxy0.getSimple(Unknown Source)
What am I missing? I know that return type processing is done using Call . But I want the service to return business objects as a type (and work in synchronization mode).
UPDATE
After adding additional dependencies and .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) , as suggested by different answers, I still get this error:
Caused by: java.lang.IllegalArgumentException: Could not locate call adapter for class simple.Simple. Tried: * retrofit.RxJavaCallAdapterFactory * retrofit.DefaultCallAdapter$1
java rest retrofit simple-framework
rmuller Aug 28 '15 at 10:37 2015-08-28 10:37
source share