Skip to Content

Empty OData in odata service url

Hi,

I was trying to get data from the odata service url. I am able to run the service in browser after logging in and able to see the data in xml format. But when I do the same in controller,its showing empty odata. Please assist me.

var oDataModel = new sap.ui.model.odata.ODataModel("http://XXXX:12345/sap/opu/odata/SAP/ZJOB_MONITOR_SRV/EtStatusSet",true,"xxxxx", "YYYY");

I have passed the log on paramaters. Still I am unable to read the data. Please find the screen shot.

Thanks and regards,

Karthik S

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Feb 21, 2017 at 08:31 AM

    check if any errors in network tab of browser debugger tool(f12) and share those details too.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 21, 2017 at 11:44 AM

    Hi Akhilesh,

    I am geting below error in console.

    XMLHttpRequest cannot load http://server:2242/sap/opu/odata/SAP/ZJOB_MONITOR_SRV/$metadata. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:64412' is therefore not allowed access. The response had HTTP status code 401.

    Regards,

    Karthik S

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 21, 2017 at 12:46 PM

    if you are running it in eclipse, you have to enable proxy

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 21, 2017 at 02:58 PM

    enable proxy for you web app

    if you don't know, just deploy the app to server to run.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 21, 2017 at 05:30 PM

    Disable your chrome web security. Properties on Chrome->Shortcut Tab->Target->type --disable-web-security

    Eg: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security

    After doing this, close all Chrome browsers, relaunch, and it will work.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 03, 2017 at 10:56 AM

    Hi,

    add "proxy" to URL

    proxy/http/server:2242/sap/opu/odata/SAP/ZJOB_MONITOR_SRV/

    Regards

    Prakash

    Add comment
    10|10000 characters needed characters exceeded