Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to read exact error response body from HTTP Request connector in Mule 4.2

We are posting PO data to Oracle instance in XML format using REST API. In a failed case, it is just a printing message from error.description example "HTTP POST on resource 'https://hostname:post/fscmService/PurchaseOrderServiceV2' failed: internal server error (500)." Now the request is to print the exact error message from Oracle Cloud ERP. When we run the same test case from Postman we can see the exact error message in the response body and I am trying to print the same response in mule logger and would like to send the same as response payload but not able to get it.

I tried to debug Mule flow and stoped in Exception handler "On Error Propagate" and looked at all variables to see actual error response but didn't find. Please advise!

Please find below screenshots for reference.

enter image description here

enter image description here

enter image description here

like image 415
user1927648 Avatar asked Mar 03 '23 03:03

user1927648


2 Answers

You can access the failed response body via error.errorMessage.payload.

like image 154
afelisatti Avatar answered Apr 30 '23 14:04

afelisatti


Here is the fix.

With out Until-Successful: We can access the failed response body via : error.errorMessage.payload or error.muleMessage.typedValue

With Until-Successful: We can access the failed response body via : error.exception.cause.errorMessage.payload or error.exception.cause.errorMessage.typedValue

Thank you.

like image 33
user1927648 Avatar answered Apr 30 '23 14:04

user1927648