Skip to Main Content

This is an IBM Automation portal for Integration products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (

Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.

Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal ( - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal ( - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM. - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Functionality already exists
Workspace DataPower Gateway
Created by Guest
Created on Apr 23, 2023

Getting response code in error rule

In case a MPG is configured with the "Process Backend Errors" option turned off, all HTTP errors from the backend server end up at the error rule, but currently there's no way to get the actual response code from the backend server. This could be useful when we want to distinguish our errors and for example return an informative error in a response body back to the client if the http code we got was 400. However, if the server failed, for example returned a 500 error code, we want to log this, maybe invoke a second operation and then return a response back to the client.

Idea priority Medium
  • Admin
    Ulas Cubuk
    Jun 30, 2023

    Hello Shahar,

    Thanks for your comments. Yes indeed I am logging different error cases from an error rule with “Process Backend Errors" option turned off.

    So there are ways for getting the response code in an error rule. However I am not dismissing that you are facing an issue here. I will send you an email to arrange a meeting so that we can further discuss.

    Thank you.


  • Guest
    Jun 27, 2023


    I'm sorry but this is simply untrue.

    I've tested it before and all I get in "hm.response.statusCode" and in "hm.response.reasonPhrase" is undefined.

    It does work fine when "Process Backend Errors" option is turned on and you get the response rule invoked, but if this option is turned off, you find yourself in the error rule with no data.

    You can see in the case that is attached to this idea my example. I have no idea, Ulas, I did you got the desired results.

    Are you sure you logged these values from the error rule? and that the "Process Backend Errors" option was turned off? because that's just not working for me.



  • Admin
    Ulas Cubuk
    Jun 26, 2023


    When the response comes from the server, you get access to fields in the response headers in GatewayScript with assignment statements in original, current, or response headers.

    var hm = require('header-metadata');

    var statuscode = hm.original.statusCode;

    var reasonphrase = hm.original.reasonPhrase;


    Or in XSLT you can use

    <xsl:value-of select="dp:http-response-header('x-dp-response-code')"/>

    The x-dp-response-code special code is a protocol response code. This special code is not a response header, but contains the protocol-specific response code.

    Then you can log or do something else according to your error handling logic... below screenshot shows an example of logging the response code logged in an error rule



    1 reply