2017-01-25 61 views
0

我想HTTP-PUT一個實體/實體集的列表(我想它與HTTP-POST類似)。以下是查詢的主體。這個查詢在Postman中起作用。如何在Apache Olingo中發佈/放置實體列表/實體集?

{ 
    "value": [ 
    { 
     "@odata.type": "Demo.GridPoint", 
     "x": 2.2, 
     "y": 1.2 
    }, 
    { 
     "@odata.type": "Demo.GridPoint", 
     "x": 4, 
     "y": 5 
    }, 
    { 
     "@odata.type": "Demo.GridPoint", 
     "x": 1, 
     "y": 9 
    } 
    ] 
} 

Demo.GridPoint是一個ComplexType

我試圖創建一個ClientEntity並添加不同的值作爲ComplexProperty

ClientEntity coordinates = client.getObjectFactory().newEntity(coordinatesFqn); 
for(/* all grid Points */){ 
    coordinates.add(client.getObjectFactory().newComplexProperty("", gridPoint)); 
} 

但是,函數newComplexProperty(String name, ClientComplexValue value)需要ComplexValue名稱。因此,生成的查詢不符合預期的格式並失敗:

{"@odata.type":"Demo.Coordinates", 
"":{"@odata.type":"Demo.GridPoint","[email protected]":"Double","x":2.2,"[email protected]":"Double","y":1.2}, 
"":{"@odata.type":"Demo.GridPoint","[email protected]":"Double","x":4,"[email protected]":"Double","y":5} 
"":{"@odata.type":"Demo.GridPoint","[email protected]":"Double","x":1,"[email protected]":"Double","y":9} 
} 

如何一個POST/PUT實體列表/一個EntitySet?

回答