How to do proper error handling in REST WebServices?
Summary:
I want to do proper error handling with REST WebServices and looking at the documentation I found that:
def conn = adf.webServices.GetTicketForAccount
try{
// Provide Account Id for which user wants to retrieve trouble ticket
def tickets = conn.GET("6637911")
println("Headers:"+conn.responseHTTPHeaders)
println("Status:"+conn.statusCode)
println("Output:"+tickets)
}catch(Exception e){
println("Headers:"+conn.responseHTTPHeaders)
println("Status:"+conn.statusCode)
println("Error:"+e)
}
But that when I call for example a POST Service Request with a wrong value it returns to me Bad Request 404 and it enters the catch exception but the variables are all null/empty.
responseHTTPHeaders is null
1