hi experts,
We have create JQM application. We are using odata services and we are authenticating the odata services through SMP. When we running the app on browser its working fine. We used phonegap container and made .ipa and its working fine on ipad. But when we are creating .apk using phonegap container its giving 403 forbidden error for put and post methods on android devices.
We have passed 'X-CSRF-TOKEN' to put and post methods. There is no error in SMP logs. There is no runtime error in gateway system.
Can anyone have any idea why its happening??
Thanks in advance.
Regards,
Supriya
Request clarification before answering.
hi,
Actually neither SMP nor netweaver gateway is giving any error. and this app is working fine on ipad and browser.
I have posted Put method code which i have written.
.ajax({
headers : {
"X-SUP-DOMAIN" : "DomainName",
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/json",
"DataServiceVersion" : "2.0",
"Accept" : "application/json,application/atom+xml,application/xml,application/atomsvc+xml",
"X-CSRF-Token" : header_xcsrf_token,
"X-SUP-APPCID" : CookieIdCreate,
"Access-Control-Allow-Origin": "*"
},
type : "PUT",
url : newurl,
dataType : "json",
data : dataFinal,
username :userName,
password :passWord,
cache:false,
//crossDomain: true,
async :false,
Timeout:50000,
success : function(jqXHR,
textStatus, errorThrown) {
alert("success");}
error : function(jqXHR,
textStatus, errorThrown) {
alert("error" +jqXHR.status);}
});
Can anyone help me in figure out actual error??
Thanks in advance,
Regards,
Supriya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Supriya,
The error looks like authorization issue. Kindly refer below ajax call format.
$.ajax({
type: "POST",
contentType: "application/atom+xml; charset=utf-8",
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + btoa(usr + ":" + pwd)); },
dataType: 'xml',
crossDomain: true,
data: datatopost,
async: true,
timeout: 40000,
url: "https://mysap/sap/opu/odata/sap/ZSALESORDERDEMO_SRV/SOHeaders",
complete: function () {
},
success: function (json) {
console.log(json);
// alert("sucess");
data1 = $(json).find('id').eq(0).text();
data2 = data1.split("'");
alert("The sales order :" +data2[1]+" is created successfully");
},
error: function (jqXHR, textStatus, errorThrown) {
alert("failure: " + errorThrown + " " + textStatus);
alert(error.innererror.errordetails[0].message);
$.mobile.loading("hide");
}
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.