Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8392

oModel.create & oModel.update ERROR:system expect the element '{http://www.w3.org/2005/Atom}entry'

$
0
0

Hi Experts,

    I'm trying to do CRUD demo app with oModel,oModel.read and oModel.remove work fine,but oModel.create and  oModel.update,I got the error :

system expect the element '{http://www.w3.org/2005/Atom}entry'

My js code:

oModel : null,  onInit : function() {  // Initialize the Model  this.oModel = new sap.ui.model.odata.ODataModel(  "proxy/sap/opu/odata/SAP/ZWODATA_SCNBLOG2_SRV/",  true, "USERNAME", "PASSWORD");  this.oModel.setHeaders(                                {                                "X-Requested-With" : "XMLHttpRequest",//JSONHttpRequest                                "Content-Type" : "application/atom+xml",                                "DataServiceVersion" : "2.0",                                "Accept" : "application/atom+xml,application/atomsvc+xml,application/xml",                                }  );  // set global models  sap.ui.getCore().setModel(this.oModel);  },
Create2 : function() {  alert("Create2");  var oEntry = {};  oEntry.Email = "hellofiori01@126.com";  oEntry.Firstname = "hello01";  oEntry.Lastname = "fiori01";  this.oModel.create('/SCNBLOG2Set',  oEntry,  null,  function(oData, oResponse){  alert("Create successful");  },  function(oError){  alert("Create failed " + oError.message);  }  );  },

1.jpg

I found it didn't post any data to server when operation is create or update,

Please help me on this. I am really stuck.

Thanks in Advance..


Viewing all articles
Browse latest Browse all 8392

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>