Topic
3 replies Latest Post - ‏2013-01-22T15:41:13Z by swlinn
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic Getting the HTTPS Status Code from WS-Proxy

‏2013-01-19T13:49:26Z |
Hello everybody,
I am trying to get the HTTP status code from a backend server in a WS-Proxy.
For example: My WS-Proxy policy ran and now got to the backend server which returned an error (for example 500 service unavailable)
I cannot see the HTTP status code (i.e 500) in any dp variable or any header whatsoever.
Is there any way to get that status code of the result from the backend server?

Thanks in advance,
Alon Ashkenazi.
Updated on 2013-01-22T15:41:13Z at 2013-01-22T15:41:13Z by swlinn
  • HermannSW
    HermannSW
    4149 Posts
    ACCEPTED ANSWER

    Re: Getting the HTTPS Status Code from WS-Proxy

    ‏2013-01-19T15:45:12Z  in response to SystemAdmin
    From dp:response-header() In Infocenter:
    http://pic.dhe.ibm.com/infocenter/wsdatap/v5r0m0/index.jsp?topic=%2Fcom.ibm.dp.xb.doc%2Fextensionfunctions79.htm
    ...
    The x-dp-response-code special code is a protocol response code that is returned to the DataPower® server. 
    This special code is not a field that is included in the response header. 
    This special code contains the protocol-specific response code.
    ...
    


     
    Hermann <myXsltBlog/> <myXsltTweets/>
    Updated on 2014-03-25T02:41:42Z at 2014-03-25T02:41:42Z by iron-man
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: Getting the HTTPS Status Code from WS-Proxy

    ‏2013-01-20T18:53:02Z  in response to SystemAdmin
    Thanks, I have tried this one but it didn't get me anything the variable was empty.
    Eventually I used this, which gives me more info but also the http status code:
    <xsl:variable name="http_status" select="dp:variable('var://service/error-headers')" />
    • swlinn
      swlinn
      1344 Posts
      ACCEPTED ANSWER

      Re: Getting the HTTPS Status Code from WS-Proxy

      ‏2013-01-22T15:41:13Z  in response to SystemAdmin
      x-dp-response-code is only available in the request and response rules. If you are in an error rule, then the service variables would provide you a "500 Internal Server Error" or something to that effect. I'm assuming you are doing your processing in an error rule.

      Regards,
      Steve