Where to transform webservice result, in Repository or ViewModel?

I have an application architectured by: View -> ViewModel -> Repository -> Datasource

My DataSource is consuming a webservice and then receiving Soap object, which I want to transform to a custom Pojo object. So, by using RxJava I am calling the datasource method by following this flow:

ViewModel

    repository.webserviceCall(data)...
            .subscribe();

Repository

public Single<SoapObject> webserviceCall(String data) {
    return dataSource.webserviceCall(data);
}

Datasource

public Single<SoapObject> webserviceCall(String data) {
    WSSoapDAO soapDAO = new WSSoapDAO("webserviceMethodName");
    soapDAO.addProperty("data", data);
    return soapDAO.call();
}

and then I would like to know where should I transform the SoapObject received in the datasource call, either in the Repository class, in the ViewModel class or in de Datasource class itself?

Thanks

Source: Android Questions

LEAVE A COMMENT