Skip to Content

How to get Exception Message throwed from Java REST API in IFlow?

Dear Expert,

I have Integration Flow that calls Java Rest API deployed on SAP Cloud Platform using HTTP adpater.
In Java Rest API, exception message is returned as HTTP return code 400 with custom error message.
I would like to generate this HTTP return message in exception subprocess of IFlow.

I have tried the code in groovy accordingly to as SAP Help described.

// copy the http error response to an iflow's property
message.setProperty("http.ResponseBody",ex.getResponseBody());
This is custom error messge throw from Java.
  try {
      System.out.print(3/0);
  } catch (Exception e) {
   return Response.status(400).entity("Json String Builder Error!").build();
  }

But I get only HTTP 400 Bad Request system error message.
How can I get my custom error message return from Java?

When I call this JAVA REST API from Postman, this custom error message return as body parameter.
If anyone knows, please kindly guide me.

Thanks and Best Regards

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Jun 30 at 10:09 AM
    Add comment
    10|10000 characters needed characters exceeded