Server Error 500 when posting to a Webservice

Hi there,   I'm building an application that will interface with an Oracle 11g database via REST. To start simple I build the GET part of the Country table. But when POSTing a new country a receive a server error 500 due to invalid insertion of NULL. When using Postman the insertion of a new country is successful. I tried changing the export JSON but with no success. Below I added some visuals and debug information. Hopefully someone can help me out. Thanks in advance   Beautified from the debugger: MxAdmin    REQUEST     {     "action":"executemicroflow",     "params":{         "name":"Stamtabellen.ACT_POSTCounty",         "params":{},         "validationGuids":[]         },     "changes":{},     "objects":[],     "profiledata":{"1544893697275-4":115}     }          RESULT     {     "actionResult":null,     "commits":[],     "changes":{         "11258999068426841":{             "CountryName":{"value":"Inner city"},             "CountyID":{"value":"BA"},             "RegionID":{value":"2"}             }         },         "resets":{},         "deletes":[],         "newpersistable":["11258999068426841"],         "objects":[{             "objectType":"Stamtabellen.Country",             "guid":"11258999068426841",             "hash":"ekgcuwRhRsRt+Da+ybwEbsiGMgX/OyRdzmGPKL1wic4=",             "attributes":{                 "CountryName":{"value":null},                 "CountyID":{"value":null},                 "RegionID":{"value":null}             }         }     ] }   EDIT: A new record could not be inserted due to null value, although there are no NULL values. Because Oracle is known to be very stringent, I added two custom HTTP headers to the POST call:   This resulted in a more sensible Error Msg = ORA-02291: Integrity error (COUNTR_REG_FK) is violated- upper key is not found. So the assumption that Country was a standalone table without references/associations is false. By changing the foreign key "region_id" to a valid value, the data is saved in the country table.   Cheers, Zef    
3 answers

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. 

AWS Online Training

AWS Certification 


I have through your query and it’s very complex.


Let’s try to solve it.


First of all,  The issue is related to a foreign key constraint violation when inserting a new record into the "Country" table in your Oracle 11g database via REST. Specifically, the error message "ORA-02291: Integrity error (COUNTR_REG_FK) is violated- upper key is not found" indicates that the foreign key constraint "COUNTR_REG_FK" is not being satisfied because the referenced key in the "Region" table is missing or invalid.


You may try to resolve this issue, follow these steps-


Verify Foreign Key Constraint: Check the foreign key constraint "COUNTR_REG_FK" in your Oracle database schema to ensure that it references the "Region" table correctly. Make sure that the "RegionID" in the "Country" table corresponds to a valid "RegionID" in the "Region" table.


Ensure Valid Foreign Key Value: When inserting a new country, make sure that you provide a valid "RegionID" in your POST request. The error message indicates that the "RegionID" is missing or incorrect. You need to provide a "RegionID" that exists in the "Region" table.


Update Your POST Request: Modify your POST request to include the correct "RegionID" value in the JSON payload. Ensure that the "RegionID" you provide in the request exists in the "Region" table. Here's an example of how your JSON payload should look:


   "CountryName": "Inner city",
   "CountyID": "BA",
   "RegionID": 2

Test the POST Request: After making these changes, test your POST request again using your application. This time, it should successfully insert a new country record into the "Country" table without encountering the ORA-02291 error.

By providing a valid "RegionID" value in your POST request, you should be able to resolve the issue related to the foreign key constraint violation, and the data will be saved in the "Country" table. MSBI training and Power BI training resources are good to go.




500 error is one type of Internal server error (overloading ) , The information which you have provided is very good. It is very useful who is looking for selenium online training.