Topic
13 replies Latest Post - ‏2013-12-19T13:16:12Z by kenhygh
SystemAdmin
SystemAdmin
6772 Posts
ACCEPTED ANSWER

Pinned topic Http response header Status code

‏2012-12-10T15:06:54Z |
Hi All,

I am getting 200 http status code.I am able to set the value to 500 with the help of xslt as I check in debug log.But when I click on raw tab of soap ui response it is showing header as HTTP/1.1 200 OK. Is it possible to change the value to HTTP/1.1 500 Error.Any help in this regard will be much appreciated.
Updated on 2013-01-16T12:33:08Z at 2013-01-16T12:33:08Z by SystemAdmin
  • Daviiid
    Daviiid
    282 Posts
    ACCEPTED ANSWER

    Re: Http response header Status code

    ‏2012-12-10T15:28:34Z  in response to SystemAdmin
    Hello

    In a response rule, try this :
    <dp:set-http-response-header name="'x-dp-response-code'" value="'500'"/>
    
    Updated on 2014-03-25T02:44:48Z at 2014-03-25T02:44:48Z by iron-man
    • HermannSW
      HermannSW
      4246 Posts
      ACCEPTED ANSWER

      Re: Http response header Status code

      ‏2013-01-03T00:05:42Z  in response to Daviiid
      >
      > In a response rule, try this :
      >
      <dp:set-http-response-header name="'x-dp-response-code'" value="'500'"/>
      


      You can never use dp:set-http-response-header for 'x-dp-response-code', see:
      http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14924153#14924153

       
      Hermann <myXsltBlog/> <myXsltTweets/>
      Updated on 2014-03-25T02:43:39Z at 2014-03-25T02:43:39Z by iron-man
      • HermannSW
        HermannSW
        4246 Posts
        ACCEPTED ANSWER

        Re: Http response header Status code

        ‏2013-01-10T16:22:21Z  in response to HermannSW
        > ...
        > You can never use dp:set-http-response-header for 'x-dp-response-code', see:
        > http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14924153#14924153
        >
        Steve made me aware that this statement is not right (because it works).

        I did lookup firmware source code, and yes,
        <dp:set-http-response-header name="'x-dp-response-code'" value="'500'"/>
        

        is valid.

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

          Re: Http response header Status code

          ‏2013-01-11T06:35:36Z  in response to HermannSW
          It still not working for me...

          My service flow is like this...

          Client-->MPG1-->MPG2-->WSP-->End Service

          Now i have put my xsl to convert 200 recieved in response to 500 in MPG2 response rule and its working till that point but when response reaches to MPG1 it again changes to 200 and at the end 200 code reaches to client.

          Also if I put my xsl in MPG1 response rule instead of MPG2 it didnt work. Do I need to place xsl in both MPG response rules. Please help me out.

          Thanks...
          • SystemAdmin
            SystemAdmin
            6772 Posts
            ACCEPTED ANSWER

            Re: Http response header Status code

            ‏2013-01-11T10:14:14Z  in response to SystemAdmin
            Assuming what your MPGW1 receives 500 error from MPGW2, you should disabled the "process backend error" option in MPGW1 so that DataPower won't convert bad response code (i.e. 500) to the good one ( 200)
            • SystemAdmin
              SystemAdmin
              6772 Posts
              ACCEPTED ANSWER

              Re: Http response header Status code

              ‏2013-01-16T12:33:08Z  in response to SystemAdmin
              Thanks JeffreyLiu for your suggestion...it works...Thanks a lot Hermann and Steve for your valuable suggestions...
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: Http response header Status code

    ‏2012-12-10T15:48:41Z  in response to SystemAdmin
    Hi David,

    Thanks for your reply...I am doing exactly same and it works well in probe following below mentioned thread

    https://www.ibm.com/developerworks/forums/message.jspa?messageID=14432385 ...But when I check raw tab of soap ui response the first line still come as HTTP/1.1 200 OK..I want this as HTTP/1.1 500 Error.
    • Daviiid
      Daviiid
      282 Posts
      ACCEPTED ANSWER

      Re: Http response header Status code

      ‏2012-12-11T08:33:03Z  in response to SystemAdmin
      Hello

      It's strange because in my SoapUi, i see #status# HTTP/1.1 500 Error

      Can you explain your inputs and outputs?
      • SystemAdmin
        SystemAdmin
        6772 Posts
        ACCEPTED ANSWER

        Re: Http response header Status code

        ‏2012-12-12T12:53:23Z  in response to Daviiid
        Hi David,

        Sorry for the late reply,I am just using the signle line as you had mentioned earlier in my xslt.I try giving 401 value and it works fine but on giving 500 its not working.
      • SystemAdmin
        SystemAdmin
        6772 Posts
        ACCEPTED ANSWER

        Re: Http response header Status code

        ‏2012-12-18T10:57:30Z  in response to Daviiid
        Hi David,

        My flow is like this. req-->mpgw-->wsp-->endservice.

        i have modified request in such a manner that after mpg it didnt reach to wsp. So when i send the req directly to wsp it didnt reach to wsp and gives me 500 error. but when i pass the req through mpg it is giving 200 and i want it to be 500.
        • swlinn
          swlinn
          1344 Posts
          ACCEPTED ANSWER

          Re: Http response header Status code

          ‏2013-01-02T22:27:29Z  in response to SystemAdmin
          Hi rdp87,

          Sorry, I'm catching up on the forum after a few weeks of vacation ... you have two services, a mpgw and wsp. Which service is setting the http status code and where in that service (response, error rule) is it being set? Howe is the service configured for "process backside errors" (advanced tab)?

          Regards,
          Steve
          • rdp87
            rdp87
            39 Posts
            ACCEPTED ANSWER

            Re: Http response header Status code

            ‏2013-12-17T20:50:56Z  in response to swlinn

            Hi Steve,

            Unfortunately my issue is not resolved yet. I am seeing strange kind of error here. I am placing an xsl in response rule of my MPGW service to set the value of error code and due to this xsl my service are failing in authentication. 

            I am not able to figure out the issue. Please let me know if this is some known issue.

            Thanks...

            • kenhygh
              kenhygh
              1342 Posts
              ACCEPTED ANSWER

              Re: Http response header Status code

              ‏2013-12-19T13:16:12Z  in response to rdp87

              Can you explain what you're doing more clearly? Sounds like you're doing AAA on the response????