无法在 WEBIDE 中使用 northwind ODATA 服务

Unable to Consume northwind ODATA service in WEBIDE

我是WEBIDE的新手,我正在尝试消费northwind odata服务,但到目前为止我一直没有成功。请查看我的代码和帮助。

目标连接测试也成功。但我仍然收到错误消息:

/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

任何建议,我可能做错了什么?

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"
        }]
    }
}

控制器

var url = "/V3/Northwind/Northwind.svc";
var oModel1 = new sap.ui.model.odata.ODataModel(url, true);
sap.ui.getCore().setModel(oModel1, "categoryList");

请尝试 sapui5 中的example

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"
      }
    }
  }
}

控制器

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

请注意,由于 https 连接和链接演练示例中提到的同源策略,证书被接受。

问题出在 manifest.json。

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

这有效