on 10-20-2014 9:25 AM
Hi,
I'm trying to open an Offline Store on Android, but everytime I'm getting the following error:
10-17 17:21:06.705: E/SMP_ODATA(8275): Failed to open store
10-17 17:21:06.705: E/SMP_ODATA(8275): com.sap.smp.client.odata.exception.ODataNetworkException: Unknown internal error occured
10-17 17:21:06.705: E/SMP_ODATA(8275): at com.sap.smp.client.odata.offline.ODataOfflineStore.openStoreSync(ODataOfflineStore.java:505)
10-17 17:21:06.705: E/SMP_ODATA(8275): at com.sap.smp.client.odata.offline.ODataOfflineStore$OpenStoreWithOptionsThread.run(ODataOfflineStore.java:412)
10-17 17:21:06.705: E/SMP_ODATA(8275): Caused by: com.sap.smp.client.odata.offline.ODataOfflineException: [-10060] An error occurred while performing a synchronization. Reason: -857 (ERROR) %1:[-10225] Message: Failure occurred while executing user supplied code
That's the code, it's running fine on iOS but not on Android:
function openStore() {
if (!haveAppID()) {
return;
}
startTime = new Date();
updateStatus2("store.open called");
var properties = {
"name": "OfflineStore1",
"host": smpServerHost,
"port": smpServerPort,
"https": false,
"serviceRoot" : appId,
"customHeaders" : {
"X-SMP-APPCID" : appCID,
"Authorization" : "Basic " + btoa(applicationContext.registrationContext.user + ":" + applicationContext.registrationContext.password)
},
"definingRequests" : {
"req1" : "/TPLSet"
}
};
store = sap.OData.createOfflineStore(properties);
store.onrequesterror = errorCallback; //called for each modification error during flush
//var options = {};
store.open(openStoreSuccessCallback, errorCallback/*, options*/);
}
I'm using Android 4.4.2, Cordova 3.5, SMP SDK 3.0.5.1 and SMP 3.0.4.0
Any ideas what could be the problem?
Thanks and best regards,
Giuliano
Hi Giuliano - ran into this same problem and found a solution. For some reason, when opening an offline store we need to pass all our customHeader properties via the streamParams property instead. Not too sure on why this is the case, as all my other requests use the customHeaders array, but this should fix your issue:
function openStore() {
if (!haveAppID()) {
return;
}
startTime = new Date();
updateStatus2("store.open called");
var properties = {
"name": "OfflineStore1",
"host": smpServerHost,
"port": smpServerPort,
"https": false,
"serviceRoot" : appId,
"streamParams" : "custom_header=Authorization:Basic " + btoa(applicationContext.registrationContext.user + ":" + applicationContext.registrationContext.password) + ";custom_header=X-SMP-APPCID:" + appCID + ";",
"definingRequests" : {
"req1" : "/TPLSet"
}
};
store = sap.OData.createOfflineStore(properties);
store.onrequesterror = errorCallback; //called for each modification error during flush
//var options = {};
store.open(openStoreSuccessCallback, errorCallback/*, options*/);
}
- Dave
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello All,
I have tried the above fix for "Store not open" or "Network Authentication error" when we try opening the offline store.But its not working.
PFB code:
"streamParams" : "custom_header=Authorization:Basic " + btoa(applicationContext.registrationContext.user + ":" + applicationContext.registrationContext.password) + ";custom_header=X-SMP-APPCID:" + appCID + ";", |
"definingRequests" : {
"ProductsDR" : "/Zemployee_list" |
}
};
Please let me know if I am going wrong here.
Thanks and Regards,
Muthu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Am also facing OdataStoreException Issue. Can anybody tell me how to resolve it the code as follows:
ODataOfflineStoreOptions options = new ODataOfflineStoreOptions();
options.host = url.getHost();
options.port = String.valueOf(url.getPort());
options.enableHTTPS = lgCtx.isHttps();
options.serviceRoot= endPointURL;
//The logon configurator uses the information obtained in the registration
// (i.e endpoint URL, login, etc ) to configure the conversation manager
System.out.println("options set");
IManagerConfigurator configurator = LogonUIFacade.getInstance().getLogonConfigurator(context);
HttpConversationManager manager = new HttpConversationManager(context);
configurator.configure(manager);
options.conversationManager = manager;
options.enableRepeatableRequests = false;
options.storeName="flight";
//This defines the oData collections which will be stored in the offline store
options.definingRequests.put("reg1", Collections.TRAVEL_AGENCY_ENTITY_TYPE);
Regards
Sathiya
Hi, | I am also getting the same error in SMP3.0SP05 offOptions = new ODataOfflineStoreOptions(); |
offOptions.host = host;
offOptions.port = port; | |||||
offOptions.serviceRoot = appId; | |||||
HttpConversationManager manager = new HttpConversationManager( | |||||
context); |
offOptions.conversationManager = manager
offOptions.definingRequests.put("req1", "/"+Utils.WORKLIST_ITEM_COLLECTION);
offOptions.username = userName;
offOptions.password = password; | |||
offOptions.appcid =appCID; | |||
offOptions.enableHTTPS=false; | |||
offlinestoreopen.setOfflineStoreListener(openofflineListener); | |||
offlinestoreopen.openStoreSync(offOptions); | |||
-sandhya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm also facing the same problem ....
Did you resolve this issue ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.