I am using retrofit 2.0.0-beta1 with SimpleXml. I want the retrieve a Simple (XML) resource from a REST service. Marshalling/Unmarshalling the Simple object with SimpleXML w
public interface SimpleService {
@GET("/simple/{id}")
Simple getSimple(@Path("id") String id);
}
Communication with the network is done with the separate thread so you should change your Simple with that.
public interface SimpleService {
@GET("/simple/{id}")
Call<Simple> getSimple(@Path("id") String id);
}
Short answer: return Call<Simple> in your service interface.
It looks like Retrofit 2.0 is trying to find a way of creating the proxy object for your service interface. It expects you to write this:
public interface SimpleService {
@GET("/simple/{id}")
Call<Simple> getSimple(@Path("id") String id);
}
However, it still wants to play nice and be flexible when you don't want to return a Call
. To support this, it has the concept of a CallAdapter, which is supposed to know how to adapt a Call<Simple>
into a Simple
.
The use of RxJavaCallAdapterFactory
is only useful if you are trying to return rx.Observable<Simple>
.
The simplest solution is to return a Call
as Retrofit expects. You could also write a CallAdapter.Factory if you really need it.