Skip to Content

OData Create entry - POST error

Hi all,

I succesfully managed update and get operation with OData but i'm facing an error when i try to create a new item in my entity set

First of all, my server side setup.

  • SEGW with entity set and entity

  • The service

  • and the test of the same

Obviously I've implemented the CREATE_ENTITY method with dummy code just to check if it's triggered

METHOD materialsset_create_entity.
   er_entity-matnr = 'TResult'.

In my page I call the Odata in this way

var itemString = "/MaterialsSet/";

var serviceURI = "/sap/opu/odata/sap/ZMATERIALS_SRV";

var username = "User";

var password = "Password";

var oModel = new sap.ui.model.odata.v2.ODataModel(serviceURI, {

user: username,

password: password});

var oEntity = {

"Code": "CodeTest",

"MaterialType": "ROH",

"Description": "Test",

"StandardPrice": 0,

"Currency": "EUR"

oModel.create(itemString, oEntity, null, function () {

sap.ui.commons.MessageBox.alert("Success!") ;

}, function () {



When the page hit my code, the metadata is retrieved succesfully but when i try to create the new entry (this is obviously a test code) i got a 202 as response for the batch

  1. Request URL:https://zzzzz:vvvvv@$batch
  2. Request Method:POST
  3. Status Code:202 Accepted
  1. But the response is

Content-Type: application/http

Content-Length: 341

content-transfer-encoding: binary

HTTP/1.1 500 Internal Server Error

Content-Type: application/json

Content-Length: 225

dataserviceversion: 1.0

{"error":{"code":"CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406","message":{"lang":"it","value":"Error while parsing an XML stream"},"innererror":{"transactionid":"578CF552A51F7AADE10000000A63040C","errordetails":[]}}}

any idea on how to solve?

gat1.png (38.3 kB)
gat2.png (14.1 kB)
gat3.png (47.6 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Jul 26, 2016 at 11:36 AM

    Hi Simone,

    Did you try capturing the request that was sent? I faced the same issue before while building some handling for batch requests and the issue had something to do with how the request was structured in regards to the changeset markers. I took the request payload and was able to fudge with it in the test frame for the Gateway until I could get it working and that gave me clues on how to adjust the UI5 code. If I recall for my case it had something to do with the default method 'MERGE' instead of 'PUT' for update which doesn't apply for you but taking that approach might help you identify the problem.


    Ryan Crosby

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 27, 2016 at 09:29 AM

    Temporary solution :

    you can set the below to the model, it will accept


    oModel.bJSON = false;



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2016 at 08:51 AM

    Hi Simone

    We exactly have the same issue? XML parsing error though the payload is correct

    What I have found so far, since we are using V2 version - we need to set a group id and change set id as parameter. But I haven't found the correct way to do it.

    Hope someone else can help here?

    Dear @Dennis Seah @Sai Vellanki - do you have any insights?



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2016 at 11:27 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2016 at 11:30 AM

    As you can see in my post, I already set up the backend system and it looks exactly the same as the link you posted.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.