1

I am new to WEBIDE, I am trying to consume northwind odata services, but so far I have been unsuccessful. Please see my code & help.

connection test on destination also was successful. but still I am getting error:

/V3/Northwind/Northwind.svc/$metadata", statusCode: 404, statusText: "Not Found", headers: Array(0), body: "The resource you are looking for has been removed,… its name changed, or is temporarily unavailable."} responseText:"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

statusCode:404 statusText:"Not Found" proto:Object

enter image description here

any suggestions, what I might be doing wrong?

neo-app.json:

{
  "path": "/destinations/northwind",
  "target": {
    "type": "destination",
    "name": "northwind"
  },
  "description": "Northwind OData Service"
}

manifest.json:

"sap.app": {
    "id": "Mod3Act3",
    "type": "application",
    "i18n": "i18n/i18n.properties",
    "title": "{{appTitle}}",
    "description": "{{appDescription}}",
    "applicationVersion": {
        "version": "1.0.0"
    },
    "dataSources": {
        "northwind": {
            "uri": "/V3/Northwind/Northwind.svc/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0"
            }
        }
    }
},

"sap.ui5": {
    "rootView": {
        "viewName": "Mod3Act3.view.Main",
        "type": "XML"
    },
    "dependencies": {
        "minUI5Version": "1.30.0",
        "libs": {
            "sap.ui.core": {},
            "sap.m": {},
            "sap.ui.layout": {},
            "sap.ushell": {},
            "sap.collaboration": {},
            "sap.ui.comp": {},
            "sap.uxap": {}
        }
    },
    "contentDensities": {
        "compact": true,
        "cozy": true
    },
    "models": {
        "": {
            "dataSource": "northwind"
        }
    },
    "resources": {
        "css": [{
            "uri": "css/style.css"
        }]
    }
}

controller

var url = "/V3/Northwind/Northwind.svc";
var oModel1 = new sap.ui.model.odata.ODataModel(url, true);
sap.ui.getCore().setModel(oModel1, "categoryList");
Star
  • 3,222
  • 5
  • 32
  • 48
Armghn
  • 144
  • 2
  • 14
  • Please, avoid using `sap.ui.model.odata.ODataModel`. [It's been deprecated](https://blogs.sap.com/2017/02/03/stop-using-sap.ui.model.odata.odatamodel-aka-v1-odatamodel-its-deprecated-since-2014/) for a long time (at least [since 1.30](https://blogs.sap.com/wp-content/uploads/2017/02/ui5-1.30.6-1.png)). Please, check the [API Reference](https://ui5.sap.com/#/api/sap.ui.model.odata.ODataModel/overview). – Boghyon Hoffmann Apr 11 '18 at 20:31
  • Also, there is no need to create an extra ODataModel in the controller. You already created and set one declaratively in the [application descriptor](https://ui5.sap.com/#/topic/be0cf40f61184b358b5faedaec98b2da) (manifest.json). If you call `this.getOwnerComponent().getModel()` from your controller, you'll get an instance of [v2.ODataModel](https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel). Take a look at https://stackoverflow.com/a/42251431 to learn more about model propagation. – Boghyon Hoffmann Apr 11 '18 at 20:35

2 Answers2

1

issue was with manifest.json.

"dataSources": { 
"northwind": {     
 "uri": "/destinations/northwind/V3/Northwind/Northwind.svc/",      
 "type": "OData",      
 "settings": {"odataVersion": "2.0" }
}
}

this worked

Armghn
  • 144
  • 2
  • 14
0

please try the example from the sapui5 walk through:

manifest.json

{
  "_version": "1.8.0",
  "sap.app": {
    ...
    "ach": "CA-UI5-DOC",
    "dataSources": {
      "invoiceRemote": {
        "uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
        "type": "OData",
        "settings": {
          "odataVersion": "2.0"
        }
      }
    }
  },
  "sap.ui": {
    ...
  },
  "sap.ui5": {
    ...
    "models": {
      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "sap.ui.demo.walkthrough.i18n.i18n"
        }
      },
      "invoice": {
        "dataSource": "invoiceRemote"
      }
    }
  }
}

controller

...
var oModel = this.getView().getModel("invoice");
...

please be aware of the accepting of the certificate due to the https connection and the same origin policy both mentioned in the linked walk through example.

n01dea
  • 1,532
  • 1
  • 16
  • 33