Rest API receiving data but not sending success back

Shivani29
Mega Guru

Hi All,

I provided rest api explorer url and third party is sending data to middleware and middleware sending the data to servicenow. I am receiving the data in ServiceNow but middleware is not receiving any success from my side. It is shaowing waiting at middleware end so it is trying again after 10 min and in servicenow we are getting multiple entries for same data. They are getting error: Server returned code: 500. Attached is the snapshot for the error and information which middleware received.

Kindly help!

Regards,
Shivani

1 ACCEPTED SOLUTION

Shivani29
Mega Guru

Thanks everyone for helping. The issue was with number of sql queries which can run at a time in servicenow. Increased the number and it started working.

 

Regards,
Shivani

View solution in original post

19 REPLIES 19

Hi Vijay,

I am getting data in u_new_join_fieldglass table in servicenow but middleware is still getting this error.

I checked the ACL and the role which is there is already added in user account.

Regards,
Shivani

Hi,

Can you please check from rest API explore or Postman with the same request body which is send by Middleware and check response.  

Richard Hine
Tera Guru
Tera Guru

You are getting an HTTP 500 rather than success. That means that ServiceNow is having an issue processing the transaction as expected.

As others have said, I recommend you capture the JSON payload from the middleware and try submitting it to the endpoint using the service account via something like postman.

Richard

Shivani29
Mega Guru

Hi All @Ankur Bawiskar @Vijay Balotia @Richard Hine ,

Thanks for your reply. I tested it in postman. From midleware they are sending as an XML. So i added content-type as application/xml in hesder and tested the same in postman and got error: 

 
{"error":{"message":"Exception while reading request","detail":"Error Parsing input streamMisshaped element. at character 1296 of 
<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n
<request>\r\n    
    <entry>\r\n        
        <u_security_id>GH12345678MATE</u_security_id>\r\n
        <u_contractor_first_name>May</u_contractor_first_name>\r\n
        <u_contractor_last_name>TEST</u_contractor_last_name>\r\n
        <u_supplier>VIRTUSA CONSULTING SERVICES PRIVATE LIMITED (710020697)</u_supplier>\r\n
        <u_start_date>05/02/2022</u_start_date>\r\n
        <u_end_date>06/30/2022</u_end_date>\r\n
        <u_requested_by>mircea.mazilu@colt.net</u_requested_by>\r\n
        <u_sow_type>FieldGlass SOW</u_sow_type>\r\n
        <u_statement_of_work_id>CTSTQ00000608</u_statement_of_work_id>\r\n
        <u_background_v_fication_check>Yes</u_background_v_fication_check>\r\n
        <u_physical_acc_access_card>Yes</u_physical_acc_access_card>\r\n
        <u_country_code_elect_country>BE</u_country_code_elect_country>\r\n
        <u_contractor_s_fice_location>COLT Telecom SA</u_contractor_s_fice_location>\r\n
        <u_is_access_to_any_required>Yes </u_is_access_to_any_required>\r\n
        <u_is_windows_i_id_required>Yes</u_is_windows_i_id_required>\r\n
        <u_cryptocard_s_ken_required>Yes </u_cryptocard_s_ken_required>\r\n
        <u_project_type>Development or Others</u_project_type>\r\n
        <u_new_starter_type>SOW Contractor</u_new_starter_type>\r\n
    </entry>\r\n
</request>\r\n\r\n\r\n"},"status":"failure"}
 
Below is the snapshot from postman as well:
 
 
 Regards,
Shivani

Hi,

the endpoint is REST Based so why are they sending XML

they should send JSON request format

try using JSON body in postman and it would work

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader