Skip to Content

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

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

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:

http://pastie.org/5477802

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

Works:

  • 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:


http://enable-cors.org/

http://stackoverflow.com/questions/1099787/jquery-ajax-post-sending-options-as-request-method-in-firefox


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

Kind regards,

Vincent





Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question