I am using .NET custom DA server with custom remoting sdk methods in addition into DataService class, remoting sdk methods will use DA login.
On Android native client, an user do a first login and view some datatable from server with DA.
Session timeout in Server is set to 20 minutes.
When a timeout occours in android client, i have implemented onLoginNeeded method as documentation for automatically reconnect and it works well.
When timeout occours in client when calling semoting sdk method, onloginneeded is not called.
There is some way to do the same as DA?
[RemObjects.SDK.Server.ServiceMethod]
public DateTime GetUtcNow()
{
return DateTime.UtcNow;
}
Net Client has a working test case to understand what i want to do with android.
Android project is async, so the testcase is reproduced manually.
On android, when session go in timeout, DataAbstract connection will relogin, but calling remoting sdk method will not reconnect.
You did set the ‘relogin needed’ event handler on the data adapter level. When you do call the SDK method you work on the connection channel level and data adapter is not involved. So when the ‘relogin needed’ event is raised there is no handler defined for it.
Adding such handler should rresolve the issue. Sample code:
channelInstance.setChannelCallback(new ClientChannel.IClientChannelCallback() {
@Override
public boolean clientChannelNeedsLogin(Exception excptn) {
// TODO Provide here your own login code
return fDataModule.getDataAdapter().login("123", "123");
}
// Alternative Login method for connecting to Relativity instance
/// @Override
/// public boolean clientChannelNeedsLogin(Exception excptn) {
/// String RelativityConnectionStringTemplate = "User Id=\"%s\";Password=\"%s\";Domain=\"%s\";Schema=\"%s\"";
/// String lLoginString = String.format(RelativityConnectionStringTemplate,
/// "simple", "simple", "DASamples", "Simple");
/// return fDataModule.getDataAdapter().login(lLoginString);
/// }
@Override
public void requestFailWithException(Exception excptn) {
// TODO Log exception
}
});
I have added this handler, but it give me this exception:
java.net.ProtocolException: cannot write request body after response has been read
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:267)
at com.remobjects.sdk.HttpClientWorker.Dispatch()
at com.remobjects.sdk.HttpClientAsyncWorker.internalDispatch()
at com.remobjects.sdk.AsyncRequest.run()