Hello everyone,
I'm coding an sapui5 application with odata in eclipse that contain ‘create’,'update','delete' method.
But when I post the request,it show me the error:Failed to load resource: the server responded with a status of 403 (Forbidden)
Here are my code:
| var requestObj= { | ||||
| requestUri: "", | ||||
| method: "", | ||||
| headers: { | ||||
| "X-Requested-With": "XMLHttpRequest", | ||||
| "Content-Type": "application/atom+xml", | ||||
| "DataServiceVersion": "2.0", | ||||
| "MaxDataServiceVersion": "2.0", | ||||
| "Accept": "application/atom+xml" | ||||
| } | ||||
| }; | ||||
| var newData = { | ||||
| "odata.type": "ZSFLIGHT_DETAIL_SRV.sflight", | ||||
| "Mandt": $("#mandt").val(),"Carrid": $("#carrid").val(),"Connid": $("#connid").val(),"Fldate": $("#fldate").val(), | ||||
| }; | ||||
| var url = "proxy/http/DEWDFLSSC5445.emea.global.corp.sap:8000/sap/opu/odata/SAP/ZSFLIGHT_DETAIL_SRV/sflightSet"; | ||||
| var method = "POST"; | ||||
| var user = "****"; | ||||
| var password = "*****"; | ||||
| requestObj.requestUri = url; | ||||
| requestObj.method = method; | ||||
| requestObj.data = newData; | ||||
| requestObj.user = user; | ||||
| requestObj.password = password; | ||||
| OData.request(requestObj,function(){ | ||||
sap.ui.getCore().getModel().refresh(); | ||||
| $("#formId").slideUp(); | ||||
| }); | ||||
| } |
}