Skip to Content
avatar image
Former Member

Error processing request stream. JSON text specified is not valid | XSOData

I am able to do a post with the XSODATA via postman client, however it wont work in the SAPUI5 application.

below is from postman.

Below is my code. I am using sap.ui.model.odata.ODataModel

with content-type" : "application/json;charset=utf-8"});

ap1.png (71.0 kB)
ap2.png (18.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 10 at 03:25 PM

    Pass the JSON object as a variable to make sure it is in the right format.

    var oEntry = {}; 
    oEntry.perno = "123456789";
    oEntry.SID = "BHAT";
    oEntry.tdate = "Apr 018";
    oEntry.vecnumber = "Ino3x";
    
    sap.ui.getCore().getModel().create('/Mileage', oEntry, null, 
       function (oResponse){
           console.log("Create successful");
           console.log(oResponse);
       },
       function (oError) {
           console.log("Create failed");
           console.log(oError); 
        }
    );

    Add comment
    10|10000 characters needed characters exceeded