How do I access the response message from my backend server when it returns a non-200 response message to my Multi-Protocol Gateway or Web Service Proxy service?
It is not possible to access the response message from an error rule. However, being able to retrieve the content of a message with a non-200 response code may be of value for the user.
One can access the response message from a backend server, when it returns a non-200 response, by enabling the "Process HTTP Errors" setting. This setting is located in the Advanced Proxy settings tab of a Web Service Proxy. Enabling the "Process Backend Errors" setting located in the Advanced tab of a Multi-Protocol Gateway is another option.
Enabling either of these settings will trigger a response rule instead of an error rule. This will cause the non-200 response message to be returned with response code 200.
If you want to return the full backend HTTP return code, you would need to have a response rule to set the following using a custom stylesheet (XSL):
<dp:set-http-response-header name="'x-dp-response-code'" value="'$rc'"/>
Where $rc could be something like:
<xsl:variable name="rc" select="dp:response-header('x-dp-response-code')"/>