on 06-24-2015 1:48 AM
Hi ALL
i am working on sap kapsel hybird app develop, my odata plugin version is com.sap.mp.cordova.plugins.odata 3.8.1 "OData", my smp server version is SMP3.0 SP7.
now i have encoutered a weird problem, my gateway service can provide an entityset with multiple records, however when i created offline odata, i only got one record! i used the same codes to retrive the rmtsampleflight demo gateway service, i can get multiple records.
Is my own odata service wrong? but when i comment the offline odata plugin, it can got multiple records. any advice wounld be helpful!
thanks
Billy
Hi billy,
Could you have a look at this discussion. Which talks about a similar problem:
Regards,Midhun
SAP Technology RIG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you see
"definingRequests" : {
//"FlightCollectionDR" : "/FlightCollection"
"EE_COMMUNICATION_SETDR" : "/EE_COMMUNICATION_SET"
}
when i changed it to
"definingRequests" : {
"FlightCollectionDR" : "/FlightCollection"
//"EE_COMMUNICATION_SETDR" : "/EE_COMMUNICATION_SET"
}
and changed the Backend URL in smp sever to /sap/opu/odata/iwfnd/rmtsampleflight/, i can get multiple records. so maybe the gateway service i created missing something?
however, you see the function function readModel() { if i use it to retrieve data directly, i can get multiple records even with my own gateway service.
so what should do with my gateway service , if you want to use offline odata plugin?
thanks,
Billy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
here is some codes.
function openStore() {
if (!haveAppId()) {
return;
}
console.log("store.open called");
var properties = {
"name": "OfflineStore",
"host": appContext.registrationContext.serverHost,
"port": appContext.registrationContext.serverPort,
"https": appContext.registrationContext.https,
"serviceRoot" : appId, //appId,
"customHeaders" : {
"X-SMP-APPCID" : appContext.applicationConnectionId,
"Authorization" : "Basic " + btoa(appContext.registrationContext.user + ":" + appContext.registrationContext.password)
},
"definingRequests" : {
//"FlightCollectionDR" : "/FlightCollection"
"EE_COMMUNICATION_SETDR" : "/EE_COMMUNICATION_SET"
}
};
console.log("appContext");
store = sap.OData.createOfflineStore(properties);
//var options = {};
store.open(openStoreSuccessCallback, errorCallback/*, options*/);
console.log("store.open called2");
}
function haveAppId() {
if (!appContext) {
alert("Please register with the SMP Server before proceeding");
return false;
}
return true;
}
function openStoreSuccessCallback() {
console.log("Store is OPEN.");
sap.OData.applyHttpClient(); //Offline OData calls can now be made against datajs.
readModel();
}
function readModel() {
var oModel;
var url = appContext.applicationEndpointURL;
var oHeader = {"X-SMP-APPCID":appContext.applicationConnectionId};
if (appContext.registrationContext.user) {
oHeader["Authorization"] = "Basic "+btoa(appContext.registrationContext.user + ":" + appContext.registrationContext.password);
}
oModel = new sap.ui.model.odata.ODataModel(url, true, null, null, oHeader);
sap.ui.getCore().setModel(oModel);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.