cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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-fir...


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

Kind regards,

Vincent




0 Likes
View Entire Topic
Former Member
0 Likes

Hi Vincent,

Check the following link.

HTML5 ROCKS - Using CORS

http://www.html5rocks.com/en/tutorials/cors/?redirect_from_locale=en

Preflight Request:

The preflight request is made as an HTTP OPTIONS request (so be sure your server is able to respond to this method)

Hope it helps.

Regards,

Christian

Former Member
0 Likes

Hello Christian,

This will not work.

I need todo something with a proxy.

Kind regards,

Vincent