Skip to Content

No public access to oData

Hi experts ๐Ÿ˜Š

To my actual issue I found a lot of questions and answers, but nothing really fits to my case.

I created a database (MDC) with tables in my HCP trial account. Via Editor I generate an OData service using the following code:





"anonymous_connection": "iotmmsxs::anonuser",

"authentication" : null,

"exposed": true



{ "privileges" :

[ {

"name" : "Basic", "description" : "Basic usage privilege"



"name" : "Public", "description" : "Public usage privilege"






"description" : "Anon SQL connection"



service namespace "iotmmsxs" {

"SYSTEM"."T_IOT_DA677557E5D134C8DAEF" as "IPHONEMELINA" key generate local "ENTRY_ID";

"SYSTEM"."T_IOT_M0T0Y0P0E1" as "AUTOIOTSERVICE" key generate local "GEN_ID";


Opening is always working, but to access for example, I have to log on.

When I am not logged on at the SAP HANA Web-based Development Workbench, this occurs:

(I guess) that is the reason why I get this error in my SAPUI5 application (WebIDE), when I want to write data from "/IPHONEMELINA" into a table:

XMLHttpRequest cannot load$metadata. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

I am thankful for any comment!

Best regards,


xsfailure.JPG (29.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 13, 2016 at 08:21 AM

    Hello Melina,

    you may combine two examples from the IoT StarterKit:

    1. Expose XSODATA (T_IOT tables) iot-starterkit/src/apps/xs/consumption at master ยท SAP/iot-starterkit ยท GitHub

    2. Consume IoT MMS ODATA from UI5 app iot-starterkit/src/apps/ui5/consumption at master ยท SAP/iot-starterkit ยท GitHub (for your usecase you will consume not MMS ODATA but your XSODATA service, communication in that example app is done via HTTP destinations -> they will solve your COSR issue mentioned by Chris above)



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Chris,

      thanks for your reply and the explanation about CORS.

      After uncountable hours spending with searching through SCN and trying a lot of changes in my project, there is public access to my oData, but the service still doesn't support CORS.

      I followed the instructions, Denis Descause mentioned in the thread you recommend me.

      I "found" XS Admin UI and also SQL Connection Details and configured them.

      Additionally I added a xsjs file and insert the following code

      I used the code from Create an XS SQL Connection Configuration - SAP HANA Developer Guide for SAP HANA Studio - SAP Library, because I don't really know where to add Denis' code.

      I noticed, that in most examples, they are using HANA Studio.

      Am I forced to create an oData via HANA Studio? Could this be the reason why the error is still the same?

      I simply have opened Editor and created the required files.

      Please excuse my frequent inquires and all misunderstanding, I am a beginner in this topic...

      Thanks and



      sqlcon.JPG (41.6 kB)
      xsjs.JPG (40.4 kB)
      pag1.JPG (50.4 kB)
      pag3.JPG (42.5 kB)
      pag1.JPG (66.3 kB)
  • Posted on Sep 13, 2016 at 08:15 AM

    Hi Melina,

    your issue appears to be CORS related rather than authentication based.

    check out CORS and #sapnwcloud on a whiteboard for a little background - might help you look in the right places to resolve your issues.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 16, 2016 at 11:34 AM

    finally it works ๐Ÿ˜Ž

    I created a new XS and UI5 project in Eclipse and integrated them like Jagannathan shows in this document Native development in SAP HANA and consuming the oData services in SAPUI5

    Many thanks to Chris and Anton for improving my understanding of XS and CORS ๐Ÿ˜Š

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.