Getting error description and code from the native service in APIGateway

Hello Team,

I have created a RESTful API in APIGateway which invokes a different service hosted in a separate webMethods EAI box.

Now when the service returns success, my API returns the payload correctly. But when it returns failure with HTTP codes 500 (say) although the response body is coming good with errorcode and error descr from the native service, the REST API is not able to forward the same.
Instead it gives a generic failure message:
Mediator encountered an error: Native service provider error. Code : 500 while executing operation
which is not explanatory to the caller system.

How to get the correct error code and error descr from the native service via API Gateway? Please suggest.

Regards,
Debapriyo

You need to add an error handling policy to your API. By default the API Gateway masks the native error response by with default message that you are seeing for security reasons.

!

Under transformation configuration, failure message ensure that you check the option for ‘Send Native Provider Fault Message’

Be careful this could potentially expose sensitive data, hence why it is disabled by default.

You can also change the default fault message from the Administrator menu → Administration → General → API Fault.

regards
John.
Product Manager
Integration & Microservice Runtime

@John_Carter4 In case of non success code from the native service(other than 2xx series response codes), i see that the response processing phase policies aren’t executed. Is there a way to overcome this. What if i want to transform the payload in case of an error from the native system? What is the correct place to do so? Additionally, is it guaranteed that the response processing policies are only executed in case of 2xx series response code from the native system.

Please refer conditional error processing.

As indicated by @srikanth.prathipati, you need to do error response mapping in the error response policy. You can see it in my screenshot above. You can invoke a service to transform the error response from there.
regards,
John.

This topic was automatically closed after 1083 days. New replies are no longer allowed.