【问题标题】:Unable to Consume northwind ODATA service in WEBIDE无法在 WEBIDE 中使用北风 ODATA 服务
【发布时间】:2018-01-09 07:29:31
【问题描述】:

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

目的地的连接测试也成功了。但我仍然收到错误:

/V3/Northwind/Northwind.svc/$metadata", statusCode: 404, statusText: “未找到”,标题:数组(0),正文:“您正在寻找的资源 for 已被删除,...其名称已更改,或暂时 不可用。"} responseText:"你要找的资源已经 已删除、更改名称或暂时不可用。”

statusCode:404 statusText:"未找到" 原型:对象

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

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");

【问题讨论】:

标签: odata sapui5 northwind


【解决方案1】:

问题在于 manifest.json。

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

成功了

【讨论】:

    【解决方案2】:

    请尝试 sapui5 walk through 中的example

    ma​​nifest.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 连接和相同的来源策略而接受证书。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多