on 06-17-2015 10:16 AM
Hi, I am getting this error:
The following problem occurred: HTTP request failed400,Bad Request,{"error {"code":"CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406"
Sap NetWeaver Gateway error log just says "Error while parsing an XML string"
writing a web application in WEBIDE using javascript. Tried to send data like this:
OData.request({
requestUri: "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/EmployeeSet",
method: "GET",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom + xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token": "Fetch"
}
},
function(data, response) {
var header_xcsrf_token = response.headers['x-csrf-token'];
var oHeaders = {
"x-csrf-token": header_xcsrf_token,
'Accept': 'application/json'
};
OData.request({
requestUri: "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/EmployeeSet",
method: "POST",
headers: oHeaders,
data: oEntry
},
function(data, request) {
console.log("Success");
},
function(err) {
console.log("Forward failed: " + err);
}
);
},
function(err) {
var request = err.request;
var response = err.response;
console.log("Error in Get -- Request " + request + " Response " + response);
}
);
oEntry has mostly Edm.String values with 1 Edm.DateTime value but that is not the problem.
I have also tried like this:
var sServiceUrl = "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
oModel.create('/EmployeeSet', oEntry, null,
function() {
alert("success");
},
function() {
alert("failure");
}
);
I still get same error. What is causing the error and how can i get over it (beer doesn't count)?
Thanks in advance,
Apparently one parameter was a number but webservice was expecting a string so i added oEntry.ParameterName.toString() and worked.
Sorry for bothering:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello German,
I received the response in the below structure.
when I did parse with oEvent.getParameters("mParameters").
I got this value in string which contains string of xml. I have to get error message from responseRaw. Its a string of xml data. I have parse this parseHTML. i got in html format.
how to parse this to get the message value from responseRaw?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
change your url like this and try,
sServiceUrl = "proxy/http/asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OData.request({
requestUri: "proxy/http/asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/",
method: "GET",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom + xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token": "Fetch"
}
},
function(data, response) {
var header_xcsrf_token = response.headers['x-csrf-token'];
var oHeaders = {
"x-csrf-token": header_xcsrf_token,
'Accept': 'application/json'
};
OData.request({
requestUri: "proxy/http/asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/EmployeeSet",
method: "POST",
headers: oHeaders,
data: oEntry
},
function(data, request) {
console.log("Success");
},
function(err) {
console.log("Forward failed: " + err);
}
);
},
function(err) {
var request = err.request;
var response = err.response;
console.log("Error in Get -- Request " + request + " Response " + response);
}
);
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.