2017-09-29 39 views
0

dataSourcesGET /entity.svc不合格批次

"dataSources": { 
    "mainService": { 
     "uri": "/backend/service/v1/entity.svc/", 
     "type": "OData", 
    } 
} 

"models": { 
    "": { 
     "dataSource": "mainService", 
     "preload": true, 
     "settings" : { 
      "sizeLimit" : 500, 
      "useBatch" : false, 
      "refreshAfterChange": false, 
      "defaultBindingMode": "TwoWay", 
      "defaultCountMode" : "None", 
      "defaultUpdateMethod" : "Put" 
     } 
    } 
} 

定義的服務,但由於某種原因,我不知道,UI5項目將調用GET /backend/service/v1/entity.svc/當初始加載,它返回幾個<collection>

但是,當我設置UseBatch爲true,則成批GET請求將失敗,與有效載荷是這樣的:

--batch_67d5-9dc2-70e0 
Content-Type: application/http 
Content-Transfer-Encoding: binary 

GET HTTP/1.1 
sap-contextid-accept: header 
Accept: application/json 
Accept-Language: en-US 
DataServiceVersion: 2.0 
MaxDataServiceVersion: 2.0 
sap-cancel-on-close: true 


--batch_67d5-9dc2-70e0- 

,因爲它似乎像什麼也沒得到請求,批量要求肯定會失敗。有沒有任何UI5/oData專家可以告訴我GET /entity.svc有什麼意義,如何修復此批或如何跳過此請求?

回答

0

我發現它是由引起數據sap.m.Table

_bindView : function (sObjectPath) { 
    var sAssignedPath = sObjectPath + "/assignedThings", 

    this._oModel.read(sAssignedPath , { 
    success : this._handleGetAssignedSuccess.bind(this, sAssignedPath), 
    error : this._handleGetAssignedError.bind(this) 
    }); 

    oTable.setModel(this._oModel); 
} 

_handleGetAssignedSuccess : function (sAssignedPath, oMsg) { 
    var oTable = this.getView().byId("tableView").byId("assignTable"), 
    oJSONModel = new JSONModel(oMsg.results); 

    oAssignTable.setModel(oJSONModel); 
}, 

//AssignTable.view.xml 
<Table 
    id="assignTable" 
    inset="true" 
    items="{ 
    path: '/' 
    }" 
> 

items="{path: '/'}"綁定意味着JSON模型數據結合使用,但同時也引發了OData的GET「/」請求。