Skip to Content
author's profile photo Former Member
Former Member

SAPUI5 Blackberry 10 issue

I'm currently experimenting with SAPUI5 by using the following example I was able to get a simple application working on mobile devices

http://scn.sap.com/community/developer-center/front-end/blog/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service--part-1

I developed an application focused for Mobile devices and in my "HANDLE_REQUEST" method I handle a few different "verbs" I have "GET" "NEW" and "SEND". I then tested on different devices.

Apple: These devices works the best with UI5

Android: The application works 100% but loads funny sometimes

My problem however is currently as follows on Blackberries

For Blackberry devices it seem the "VERB" is always "GET" and it does not pass any parameters to SAP. Has anyone else experienced the same issue? Is there something different I need to do in the JSON model?

Thanks for your help

Christiaan

Some Sample code:

Calling of the model:

var oLocalModel = new mobileModel;

var oParameters = {

"pernr" : somePernr

};

oLocalModel.loadDataNew("../../../sap/m5data", handleSuccess, handleError, oParameters, true, 'SEND', true, undefined);

The model:

jQuery.sap.require("sap.ui.model.json.JSONModel");

sap.ui.model.json.JSONModel.extend("mobileModel", {

loadDataNew : function(sURL, fnSuccess, fnError, oParameters, bAsync, sType, bMerge, bCache) {

var busyDialog = new sap.m.BusyDialog({

title : 'Connecting to Server'

});

busyDialog.open();

var that = this;

if (bAsync !== false) {

bAsync = true;

}

if (bCache === undefined) {

bCache = this.bCache;

}

this.fireRequestSent({

url : sURL,

type : sType,

async : bAsync,

info : "cache=" + bCache + ";bMerge=" + bMerge

});

jQuery.ajax({

url : sURL,

async : bAsync,

dataType : 'json',

cache : bCache,

data : oParameters,

type : sType,

success : function(oData) {

busyDialog.close();

if (!oData) {

jQuery.sap.log.fatal("The following problem occurred: No data was retrieved by service: " + sURL);

}

that.oDataOrig = {};

that.oDataOrig = jQuery.extend(true, {}, that.oDataOrig, oData);

that.setData(oData, bMerge);

that.fireRequestCompleted({

url : sURL,

type : sType,

async : bAsync,

info : "cache=false;bMerge=" + bMerge,

});

if (typeof fnSuccess === 'function') {

fnSuccess(oData);

}

},

error : function(XMLHttpRequest, textStatus, errorThrown) {

busyDialog.close();

jQuery.sap.log.fatal("The following problem occurred: " + textStatus, XMLHttpRequest.responseText + "," + XMLHttpRequest.status + "," + XMLHttpRequest.statusText);

that.fireRequestCompleted({

url : sURL,

type : sType,

async : bAsync,

info : "cache=false;bMerge=" + bMerge,

});

that.fireRequestFailed({

message : textStatus,

statusCode : XMLHttpRequest.status,

statusText : XMLHttpRequest.statusText,

responseText : XMLHttpRequest.responseText,

});

if (typeof fnError === 'function') {

fnError({

message : textStatus,

statusCode : XMLHttpRequest.status,

statusText : XMLHttpRequest.statusText,

responseText : XMLHttpRequest.responseText

});

}

}

});

},

});

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    Posted on Jul 04, 2013 at 12:46 AM

    Hi Christiaan,

    I think you may find that "NEW" and "SEND" are not valid HTTP request methods. Below is an extract from the SAPUI5 documentation (which is also stated in the jQuery.ajax doc):

    The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.

    These links may help to explain further:

    http://www.w3schools.com/tags/ref_httpmethods.asp

    http://en.wikipedia.org/wiki/Representational_state_transfer

    Cheers,

    Ian

    Add comment
    10|10000 characters needed characters exceeded