Accessing returned message of non-200 HTTP Response

Technote (FAQ)


Question

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?

Cause

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.

Answer

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')"/>

Rate this page:

(0 users)Average rating

Document information


More support for:

IBM DataPower Gateways
General

Software version:

4.0.2, 5.0.0, 6.0.0, 6.0.1, 7.0.0

Operating system(s):

Firmware

Reference #:

1635555

Modified date:

2013-05-06

Translate my page

Machine Translation

Content navigation