on 02-11-2014 10:38 AM
Hi there,
I'm getting an Error when i do a oModel.update() request against the Netweaver Gateway.
The following problem occurred: HTTP request failed500,Internal Server Error,{"error":{"code":"CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406","message":{"lang":"en","value":"Error while parsing an XML stream"}
It's no problem to read or create entities - everything works fine.
So for update with json I do a read on the specific entity.
In my onReadSuccess function i do the oModel.refreshSecurityToken() to get the X-CSRF-Token. (works, too)
Then I define the data which changes.
var oEntry = {};
oEntry.ID = id (dynamic);
oEntry.Name = name (dynamic);
var oParams = {};
oParams.fnSuccess = function() {alert("update successful"};
oParams.fnError = function() {alert("update failed"};
After that I do the oModel.update() in the oModel.read()-onReadSuccess function.
oModel.update(ServiceUrl, oEntry, oParams);
But here I'm getting error: error while parsing an XML stream
Does anybody know what to do? I read sth. about clearing the results & metadata but don't know how to do with JSON-Model.
Thank you very much
Greetz
Hi Tobias, Your request body is json, so I am not sure why it gives a XML parse error.
When you instantiate the model, can you pass the second parameter as 'true' so that json will be set as the content type.? Alos, check in the network tab (in Dev tools) on what is the content-type header sent as.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it!
I tried different ways, and I think it was the definition of the oEntry.
I did:
var oEntry = {};
oEntry[" Id "] = Id;
oEntry[" Name "] = name;
I have changed it to:
oEntry.Id = id;
oEntry.Name = name;
and... he did it !
I did oEntry["id"] = because i read about it in another thread, that it should work.
Anyway, now I can update.
Thank you very much Krishna.
Greetz
Ok so you had error in definition of oEntry. you can also refer Documentation/AdvancedTopics/DataBinding/ODataWrite – SAPUI5 Wiki (TIP CORE User Interface) for examples on how CRUD operations are called on ODataModel.
BR,
Chandra
Krishna ,
I am facing the same error ..
And content type is application/json in my network tab ,
var oModel1 = new sap.ui.model.odata.ODataModel( serviceUrl ,true);
Also in my constructor i am sending true .
Can you help me how to debug further .
Though i send JSON , i am getting Error while parsing an XML stream
Hi,
You can refer thread and Error while parsing an XML stream | SCN on similar kind of error.
Please check if this works!
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.