Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SAPUI5 1.30.8 OData Model - create function fail

I am hosting a UI5 application on HCP.

UI5 Version 1.30.8 has been recently released, and HCP automatically runs the latest version of UI5.

I have an OData model in my application, on which I performed a "create" (or HTTP POST) on version 1.28.9 successfully.

Since the UI5 upgrade this POST has stopped working.

I get the following error:

First the "refresh security token" request, which gets a 200 and the CSRF token, followed by the POST. Which isn't even attempted.

The Request:

In the error handler I got this text: "The following problem occurred: Failed to execute 'send' on 'XMLHttpRequest".

Any ideas why this is happening?

My code is here:

var mODataModel = new sap.ui.model.odata.ODataModel("/ticketupdater");

  mODataModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);

  oComponent.setModel(mODataModel, "ticket");

  mODataModel.refreshSecurityToken();

  mODataModel.create("/SEOD_TicketUpdater_BORootCollection",

  oUpdate Obj, //JSON object for creation

  {

  async : false,

  success : function(oData){

     //handle success (code removed)

  }, error : function(err){

       //handle error (code removed)

  }

  }

  );

When I do this POST in a rest client or from an older version UI5 application, the request works perfectly. So it is an issue with doing the POST from this version of UI5, I believe. I cannot see any difference in the OData model control in the SAPUI5 sdk though, for create...

Tags:
Former Member
Former Member replied

I was missing HTTPS in my destination, and instead pointing to HTTP.

Fixing this resolved the issue, no code change required

thank you

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question