Hi,
I am trying to use oData Update functionality. Below is the code sample. I am trying to do this on HANA instance on AWS.
var saveModel = new sap.ui.model.odata.ODataModel("http://ec2-54-213-97-224.us-west-2.compute.amazonaws.com:8000/workshop/sessiona/01/services/MarketInfo.xsodata/", true,null,null,{"Content-Type": "application/json;charset=utf-8"});
var oTable = sap.ui.getCore().byId('tableid');
var oModel = oTable.getModel();
var ModelData = oModel.getData();
for(var i = 0 ; i < 1 ; i++)
{
var id = ModelData[i].id;
var oEntry = {
"FRACTION":"4.3",
"MARKETID" : "00001",
"YEAR":"2013",
"MONTH":"08",
"INDUSTRY":"ENTERTAINMENT"
};
var oParams = {};
oParams.fnSuccess = function (){};
oParams.fnError = function () {};
saveModel.update("/MarketInfo('"+id+"')", oEntry, oParams);
}
I have set the bJSON flag to true and also set the Content -Type. However when I run the application I get 415 Unsupported Media Type Error.
Below is the trace:
- Request URL:http://ec2-54-213-97-224.us-west-2.compute.amazonaws.com:8000/workshop/sessiona/01/services/MarketInfo.xsodata/MarketInfo('00002')
- Request Method:PUT
- Status Code:415 Unsupported Media Type
- Request Headersview parsed
- Request Payloadview parsed
- Response Headersview parsed
The content type for request header is only application / json and this seems to be creating the problem. Please let me know how I can override the content type.
Thanks,
Aamod