Hi All,
I am trying to implement a simple usecase where i want to insert data into DB table using POST, below are the steps i followed,
1. I have created an ADF BC Rest Web service (Ver 12.2.1) with one EO and its corresponding VO. Exposed this VO as rest resource with create,delete,update options checked. Secured this application with ADF Authenication same as done in this blog "http://andrejusb.blogspot.in/2016/10/oracle-jet-and-adf-bc-rest-security.html"
2. Now, i have created a REST Client (Oracle JET Application) from where i am calling REST resouce using below code snippet,
self.userName = ko.observable("Alan");
self.passWord = ko.observable("welcome1");
self.loginClick = function () {
var jsObj = {
"Username": "test.test@abc.com",
"Sitename": "Test Site Demo for AJAX",
"Url": "https://www.oracle.com/"
};
$.ajax({
url: 'http://127.0.0.1:7101/Service/rest/12/insertData',
type: 'POST',
dataType: "json",
data: JSON.stringify(jsObj),
contentType: 'application/vnd.oracle.adf.resourceitem+json',
headers: {"Authorization": 'Basic ' + btoa(self.userName() + ":" + self.passWord())},
success: function (data) {
console.log("Success data is : " + JSON.stringify(data));
},
error: function (jqXHR, textStatus, errorThrown) {
console.log("Error thrown ==>> " + errorThrown + " ::: " + textStatus + " ::: " + jqXHR.status);
}
});
################ I am getting below error ####################
jquery-3.1.0.js:9392 OPTIONS http://127.0.0.1:7101/Service/rest/12/insertData 501 (Not
Implemented)
index.html:1 XMLHttpRequest cannot load
http://127.0.0.1:7101/Service/rest/12/insertData. Response for preflight has invalid HTTP status code 501
#################################################################
However, the same service with same payload and same content-type is working fine from POSTMAN.
Any help or suggestion on this issue will be very helpful.
Thanks,
Alankrut