Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Cross Origin Policy/OData services

$
0
0

I've developed a couple of OData services via SEGW and Net Weaver Gateway, and everything is working fine. However, when I write JS to consume them, I'm getting a Cross Origin Policy.

 

Within my 'DPC_EXT' class in the redefined 'GET_ENTITYSET' method, I've tried adding the code:

 

data:  ls_header               TYPE ihttpnvp.

ls_header-name = 'Access-Control-Allow-Origin' .

ls_header-value = '*'.

/iwbep/if_mgw_conv_srv_runtime~set_header( ls_header ).

 

-----------------------------------

 

Here is my JS call:

 

$.ajax({

       url: 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/',

       dataType: 'XML',

       success: function (result) {

       alert(result)

     }});

 

-----------------------------------


I'm still getting this error:


XMLHttpRequest cannot load http://XXXXXXXXXXXXXXXXX. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8082' is therefore not allowed access.


Any help is appreciated!


Viewing all articles
Browse latest Browse all 2823

Trending Articles



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