on 06-09-2015 4:29 PM
Hi All,
I am trying to call AS400 DB Services in SAP UI5 using AJAX Call.
In Service we have to pass 3 parameter in request header
1. api-key
2. UserId
3. password
I am calling URL using below code:
var url = "https://iservicesdev.mscdirect.com/process/svrbrokr?BRK_SERVICE_ID=Lookup&format=Json&Type=XXXX";
jQuery.sap.require("sap.ui.model.odata.datajs");
$.ajax({
type : "GET",
contentType : 'application/json',
dataType : 'json',
crossDomain : true,
url : url,
'api-key' : 'XXXXX',
userId : 'XXX',
password : 'XXXX',
success : function(response, status, request)
{
debugger
console.log(response);
console.log(response.LookupResponse.Rows.Row.length);
var oModel = new sap.ui.model.json.JSONModel(response.LookupResponse.Rows);
that.getView().setModel(oModel);
},
error : function(jqXHR, textStatus,errorThrown)
{
alert(" No success");
}
});
},
But it is not able to pass those 3 parameter in request header.
I checked it in Chrome inspect element -> Network
It is not showing those 3 parameter.
But if i add these 3 parameter using Modify header Chrome plugin then those parameter get added in request header and works fine. which is not correct in production environment.
Kindly check my AJAX call.If you have any other way to do AJAX call ,please provide.
Thanks
Vivek
Dude, really??
$.ajax({
type : "GET",
contentType : 'application/json',
dataType : 'json',
crossDomain : true,
url : url,
headers: {
'api-key' : 'XXXXX',
userId : 'XXX',
password : 'XXXX',
},
....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got a strange Problem with my ajax POST
this is my Code for the Post.
in the Console from Chrome my Custom Header "Abc" is successfully added to the Request Headers.
But in the Backend i only recieve these standard Headers and my Custom Header is not there. When i change the Value of a standart Header, for example content-type this value is recieved correct. But when i add a Custom Header not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.