13 Replies Latest reply: Dec 24, 2012 4:12 PM by Vincent Wouters RSS

SAPUI5 Cross-origin resource sharing issues while Posting to backend.

Vincent Wouters
Currently Being Moderated

Hello SAPUI5 people,


I'm still having some issues with posting to the SAP backend.


The Problem:

I am using jQuery to post to the SAP backend via the following code:




I added a debugger to the incoming webservice call in SAP and it says Method: OPTIONS instead of Method: POST.


I have tested this from my local webserver & via the sap cloud portal.



The big But

When I simply run that code via an HTML file in Internet Explorer, and look at the debugger it says Method: POST and adds my data the my table.


My local code:  http://pastie.org/5477806


Now the big But, when I run the same file in Firefox / Chrome, the Method turns to OPTIONS again.



What needs to happen (don't know how)

SAP needs to enable cross-origin resource sharing on the online webserver.

Or someone needs to suggest me a better way of doing this.



Temp Fix (bad practice)

I can replace the Method Options to Method Post, hard coded. But this is dirty nasty code.



Temp conclusion


  • Post to SAP Backend via Internet Explorer and simple HTML File


Does not Work:

  • Post to SAP Backend via Firefox & Chrome via simple HTML File
  • Post to SAP Backend via IE, FF and Chrome on Local SAP Eclipse Webserver.
  • Post to SAP Backend via IE, FF and Chrome on SAP Cloud Trial account



More information about CORS:







I hope someone can help me, because I spend a lot of time figuring this out.



Kind regards,