Topic
  • 21 replies
  • Latest Post - ‏2014-07-23T19:31:56Z by W7VA_Barry_Knapp
smashyrahul
smashyrahul
396 Posts

Pinned topic converting 200 to 404 http response

‏2013-06-17T13:16:32Z |

Hello Experts,

I have one question.

Below is the flow of request and response.

SoapUi client --> DataPower gateway service --> DataPower backend service -> Java service (deployed on jboss)

Now, in a particular case, Java service send a '404 page not found' response and we should receive the same http response in soapUi as well

But in Soapui is receiving the '200 OK' http header rather than '404 page not found'.

Please help me in letting me know, how can I configure datapower to send 404 response to soapui.

I know i can do it using <dp:set-http-response-header name= "'x-dp-response-code'" value= "'404" />.

But I am not sure where to implement this? whether in datapower backend service or in a gateway service.

Thanks,

Rahul

  • kenhygh
    kenhygh
    1619 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-17T15:29:12Z  

    Rahul,

    You'll need to determine which service is doing the conversion - the probe is probably the simplest way to figure it out. Then you can apply your code in the correct service.

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-17T16:50:38Z  
    • kenhygh
    • ‏2013-06-17T15:29:12Z

    Rahul,

    You'll need to determine which service is doing the conversion - the probe is probably the simplest way to figure it out. Then you can apply your code in the correct service.

    Actually, the interesting this is, datapower is able to process 403 http status through to the client ..but in case of 404, it is passing 200 http status code to the client.

    how can we explain this behaviour of datapower?

    Rahul

  • swlinn
    swlinn
    1348 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-17T22:48:39Z  

    Actually, the interesting this is, datapower is able to process 403 http status through to the client ..but in case of 404, it is passing 200 http status code to the client.

    how can we explain this behaviour of datapower?

    Rahul

    What is your setting for your service's "Process Backside Errors"? If enabled, you'd have to set x-dp-response-code with the value that was returned.  If disabled, all I can think of is that DataPower isn't treating a 404 as a critical error to drive your error processing, whereas 403 is.  If that is the case, you'll need to set x-dp-response-code in your response rule anyway.

    Regards,

    Steve

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T12:25:20Z  
    • swlinn
    • ‏2013-06-17T22:48:39Z

    What is your setting for your service's "Process Backside Errors"? If enabled, you'd have to set x-dp-response-code with the value that was returned.  If disabled, all I can think of is that DataPower isn't treating a 404 as a critical error to drive your error processing, whereas 403 is.  If that is the case, you'll need to set x-dp-response-code in your response rule anyway.

    Regards,

    Steve

    Hi Steve,

    In my MPGW service, "Process Backside Errors" is enabled. The same service is processing 403 but not processing 404.

    Regards,

    Rahul

  • swlinn
    swlinn
    1348 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T14:49:16Z  

    Hi Steve,

    In my MPGW service, "Process Backside Errors" is enabled. The same service is processing 403 but not processing 404.

    Regards,

    Rahul

    Hi Rahul,

    I suppose you can open a PMR to get a definitive answer from development on if this is working as designed, but regardless, if you want to propagate the HTTP response code, it appears you must do

            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />

    Setting it explicitly will propagate the http response code regardless of what the firmware is or isn't doing.

    Regards,

    Steve

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T16:12:36Z  
    • swlinn
    • ‏2013-06-18T14:49:16Z

    Hi Rahul,

    I suppose you can open a PMR to get a definitive answer from development on if this is working as designed, but regardless, if you want to propagate the HTTP response code, it appears you must do

            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />

    Setting it explicitly will propagate the http response code regardless of what the firmware is or isn't doing.

    Regards,

    Steve

    Hi Steve,

     

    I have used the below stylesheet in the response rule of the both MPGW services.But still, I am getting 200 OK HTTP status on the client side.

    There are two datapower MPGW services between client and the backend Java service and I am using the this transform rule in both the DataPower services.

    SoapUi client --> DataPower gateway service --> DataPower backend service -> Java service (deployed on jboss)

    Do I need to do anything different?

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="dp regexp exsl" >  
    
    <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
    <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" /> 
    </xsl:stylesheet>
    

     

    Regards,

    Rahul

  • swlinn
    swlinn
    1348 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T16:27:04Z  

    Hi Steve,

     

    I have used the below stylesheet in the response rule of the both MPGW services.But still, I am getting 200 OK HTTP status on the client side.

    There are two datapower MPGW services between client and the backend Java service and I am using the this transform rule in both the DataPower services.

    SoapUi client --> DataPower gateway service --> DataPower backend service -> Java service (deployed on jboss)

    Do I need to do anything different?

    <pre dir="ltr"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="dp regexp exsl" > <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" /> <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" /> </xsl:stylesheet> </pre>

     

    Regards,

    Rahul

    Place the two statements inside a template.  I also removed unnecessary namespaces:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
        
        <xsl:template>
            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />
        </xsl:template>
        
    </xsl:stylesheet>
     

    Regards,

    Steve

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T16:40:28Z  
    • swlinn
    • ‏2013-06-18T16:27:04Z

    Place the two statements inside a template.  I also removed unnecessary namespaces:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
        
        <xsl:template>
            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />
        </xsl:template>
        
    </xsl:stylesheet>
     

    Regards,

    Steve

    Thank you very much Steve,

    It is working absolutely fine now.

    Cheers,

    Rahul

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T17:07:54Z  
    • swlinn
    • ‏2013-06-18T16:27:04Z

    Place the two statements inside a template.  I also removed unnecessary namespaces:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
        
        <xsl:template>
            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />
        </xsl:template>
        
    </xsl:stylesheet>
     

    Regards,

    Steve

    Hi Steve,

    just one issue I am getting here now.

    Backend server is sending the '403 forbidden' error. But datapower is sending it as '403 processed' trhough to the client if I use the xsl mentioned in the previous post.

    Regards,

    Rahul

     

  • swlinn
    swlinn
    1348 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T19:28:49Z  

    Hi Steve,

    just one issue I am getting here now.

    Backend server is sending the '403 forbidden' error. But datapower is sending it as '403 processed' trhough to the client if I use the xsl mentioned in the previous post.

    Regards,

    Rahul

     

    Hi Rahul,

    The code is simply setting the response code to what was received, and I have not noticed this behavior before.  You could add a

    <xsl:message dp:priority="debug">Backend HTTP status = <xsl:value-of select="$rc" /></xsl:message>

    to dump the response code into your logs, but you'd need a packet capture to verify what was actually coming into DataPower as the backside connection processing could be changing it before the response gets to your processing rules.  I'm surprised the text portion of the message is being modified.  I suppose you could also add a <xsl:choose> and a <xsl:when test="starts-with($rc, '403')" /> where you set the x-dp-response-code back to 403 Forbidden to change it back, otherwise, just pass through what was provided.

    Regards,

    Steve

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-18T19:32:52Z  
    • swlinn
    • ‏2013-06-18T19:28:49Z

    Hi Rahul,

    The code is simply setting the response code to what was received, and I have not noticed this behavior before.  You could add a

    <xsl:message dp:priority="debug">Backend HTTP status = <xsl:value-of select="$rc" /></xsl:message>

    to dump the response code into your logs, but you'd need a packet capture to verify what was actually coming into DataPower as the backside connection processing could be changing it before the response gets to your processing rules.  I'm surprised the text portion of the message is being modified.  I suppose you could also add a <xsl:choose> and a <xsl:when test="starts-with($rc, '403')" /> where you set the x-dp-response-code back to 403 Forbidden to change it back, otherwise, just pass through what was provided.

    Regards,

    Steve

    Hi Steve,

    I have used below stylesheet  (Pasted below)in an attempt to modify the content. But I am still getting the '404 processed' or '403 processed'.

    Please check the below link too, where some user has mentioned the same issue.

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014532757&ps=25

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
        
        <xsl:template match='/'>
            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            
            
           <xsl:choose>
           <xsl:when test="contains ($rc,'404')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'404 not found'"/>
            <xsl:message dp:type="business-log" dp:priority="info">response code is 404. Hence setting response code to 404 not found</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'403')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'403 Forbidden'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 403. Hence setting response code to 403 Forbidden</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'500')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'500 Internal Server Error'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 500. Hence setting response code to 500 Internal Server Error</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'200')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'200 OK'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 200. Hence setting response code to 200 OK</xsl:message>
           </xsl:when>
           
           <xsl:otherwise>
           <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />
           <xsl:message dp:type="business-log" dp:priority="info">setting response code as is</xsl:message>
           </xsl:otherwise>
           </xsl:choose>
            
            
        </xsl:template>

     

    Regards,

    Rahul

  • Miel
    Miel
    50 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-19T03:59:33Z  

    Hi Steve,

    I have used below stylesheet  (Pasted below)in an attempt to modify the content. But I am still getting the '404 processed' or '403 processed'.

    Please check the below link too, where some user has mentioned the same issue.

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014532757&ps=25

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
        
        <xsl:template match='/'>
            <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" />
            
            
           <xsl:choose>
           <xsl:when test="contains ($rc,'404')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'404 not found'"/>
            <xsl:message dp:type="business-log" dp:priority="info">response code is 404. Hence setting response code to 404 not found</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'403')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'403 Forbidden'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 403. Hence setting response code to 403 Forbidden</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'500')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'500 Internal Server Error'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 500. Hence setting response code to 500 Internal Server Error</xsl:message>
           </xsl:when>
           
           <xsl:when test="contains ($rc,'200')">
           <dp:set-http-response-header name="'x-dp-response-code'" value="'200 OK'"/>
           <xsl:message dp:type="business-log" dp:priority="info">response code is 200. Hence setting response code to 200 OK</xsl:message>
           </xsl:when>
           
           <xsl:otherwise>
           <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" />
           <xsl:message dp:type="business-log" dp:priority="info">setting response code as is</xsl:message>
           </xsl:otherwise>
           </xsl:choose>
            
            
        </xsl:template>

     

    Regards,

    Rahul

    Hi Rahul,

                   I would like to suggest you that instead of using

    <dp:set-http-response-header name="'x-dp-response-code'" value="'200 OK'"/> 

    try to set the value for the below variable in your error rule stylesheet .

    <dp:set-variable name="'var://service/error-protocol-response'" value="200/404..."/> and <dp:set-variable name="'var://service/error-protocol-reason-phrase'" value="'Not Found/Forbidden...'"/> 

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-19T08:57:24Z  
    • Miel
    • ‏2013-06-19T03:59:33Z

    Hi Rahul,

                   I would like to suggest you that instead of using

    <dp:set-http-response-header name="'x-dp-response-code'" value="'200 OK'"/> 

    try to set the value for the below variable in your error rule stylesheet .

    <dp:set-variable name="'var://service/error-protocol-response'" value="200/404..."/> and <dp:set-variable name="'var://service/error-protocol-reason-phrase'" value="'Not Found/Forbidden...'"/> 

    Hello Miel,

    But these variables can be set in an error rule and not in the response rule. So this is not the solution of this problem :(.

    Regards,

    Rahul

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-19T09:51:21Z  
    • swlinn
    • ‏2013-06-18T19:28:49Z

    Hi Rahul,

    The code is simply setting the response code to what was received, and I have not noticed this behavior before.  You could add a

    <xsl:message dp:priority="debug">Backend HTTP status = <xsl:value-of select="$rc" /></xsl:message>

    to dump the response code into your logs, but you'd need a packet capture to verify what was actually coming into DataPower as the backside connection processing could be changing it before the response gets to your processing rules.  I'm surprised the text portion of the message is being modified.  I suppose you could also add a <xsl:choose> and a <xsl:when test="starts-with($rc, '403')" /> where you set the x-dp-response-code back to 403 Forbidden to change it back, otherwise, just pass through what was provided.

    Regards,

    Steve

    Hi Steve,

    Now here is the current situation.

    DataPower is able to pass through all the responses as is ( e.g 403 Forbidden, 500 Internal Server error, 200 Ok) from backend.

    But unable to pass through '404 Not Found' from backend. Whenever, backend is sending '404 Not found', DataPower is converting it to' 200 OK'.

    To change this behaviour, I have used the stylesheet which I have pasted in the previous posts. When I used the transform action and use this stylesheet, datapower is converting '404 Not Found' to '404 Processed' and '403 Forbidden' to '403 Processed'.

    This is a real strange behaviour. I have captured the value of rc coming from backend in logs, and it confirmed that backend is sending '404 Not Found'.

    I have two questions/ or the observation from DataPower behaviour.

    1) Why DataPower will pass through all the http responses as is, except '404 Not Found'?

    2) When I am trying to set the value of 'x-dp-response-code' using the stylesheet , why it is being converted to 'Processed'?

     

    Regards,

    Rahul

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-20T09:30:56Z  

    Hi Steve,

    Now here is the current situation.

    DataPower is able to pass through all the responses as is ( e.g 403 Forbidden, 500 Internal Server error, 200 Ok) from backend.

    But unable to pass through '404 Not Found' from backend. Whenever, backend is sending '404 Not found', DataPower is converting it to' 200 OK'.

    To change this behaviour, I have used the stylesheet which I have pasted in the previous posts. When I used the transform action and use this stylesheet, datapower is converting '404 Not Found' to '404 Processed' and '403 Forbidden' to '403 Processed'.

    This is a real strange behaviour. I have captured the value of rc coming from backend in logs, and it confirmed that backend is sending '404 Not Found'.

    I have two questions/ or the observation from DataPower behaviour.

    1) Why DataPower will pass through all the http responses as is, except '404 Not Found'?

    2) When I am trying to set the value of 'x-dp-response-code' using the stylesheet , why it is being converted to 'Processed'?

     

    Regards,

    Rahul

    Hello Experts,

    Any suggestions about this issue??

    Regards,

    Rahul

  • swlinn
    swlinn
    1348 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-20T10:46:40Z  

    Hi Steve,

    Now here is the current situation.

    DataPower is able to pass through all the responses as is ( e.g 403 Forbidden, 500 Internal Server error, 200 Ok) from backend.

    But unable to pass through '404 Not Found' from backend. Whenever, backend is sending '404 Not found', DataPower is converting it to' 200 OK'.

    To change this behaviour, I have used the stylesheet which I have pasted in the previous posts. When I used the transform action and use this stylesheet, datapower is converting '404 Not Found' to '404 Processed' and '403 Forbidden' to '403 Processed'.

    This is a real strange behaviour. I have captured the value of rc coming from backend in logs, and it confirmed that backend is sending '404 Not Found'.

    I have two questions/ or the observation from DataPower behaviour.

    1) Why DataPower will pass through all the http responses as is, except '404 Not Found'?

    2) When I am trying to set the value of 'x-dp-response-code' using the stylesheet , why it is being converted to 'Processed'?

     

    Regards,

    Rahul

    Hi Rahul,

    I don't have any answers.  I'd suggest you open a PMR. Also, I'm not sure what you are doing in your response rule in addition to setting the response code, but you could also try to set Process Backside Errors off and see if the status codes are preserved in your error rule.

    Regards,

    Steve

  • dave_mo
    dave_mo
    18 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-21T18:15:22Z  

    Hi Steve,

     

    I have used the below stylesheet in the response rule of the both MPGW services.But still, I am getting 200 OK HTTP status on the client side.

    There are two datapower MPGW services between client and the backend Java service and I am using the this transform rule in both the DataPower services.

    SoapUi client --> DataPower gateway service --> DataPower backend service -> Java service (deployed on jboss)

    Do I need to do anything different?

    <pre dir="ltr"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="dp regexp exsl" > <xsl:variable name="rc" select="normalize-space(dp:response-header('x-dp-response-code'))" /> <dp:set-http-response-header name="'x-dp-response-code'" value="$rc" /> </xsl:stylesheet> </pre>

     

    Regards,

    Rahul

    Rahul,

    This worked for me in a stylesheet in the response rule and "Process Backend Errors" = on.

    <xsl:variable name="x-dp-response-code" select="dp:http-response-header('x-dp-response-code')"/>
    <dp:set-response-header name="'x-dp-response-code'" value="$x-dp-response-code"/>

    The difference being "set-response-header" not  "set-http-response-header".

    I haven't tried 403, but 404 worked.

    ie: HTTP/1.1 404 Not Found

    Hope it helps.

    - Dave

  • smashyrahul
    smashyrahul
    396 Posts

    Re: converting 200 to 404 http response

    ‏2013-06-21T19:45:19Z  
    • dave_mo
    • ‏2013-06-21T18:15:22Z

    Rahul,

    This worked for me in a stylesheet in the response rule and "Process Backend Errors" = on.

    <xsl:variable name="x-dp-response-code" select="dp:http-response-header('x-dp-response-code')"/>
    <dp:set-response-header name="'x-dp-response-code'" value="$x-dp-response-code"/>

    The difference being "set-response-header" not  "set-http-response-header".

    I haven't tried 403, but 404 worked.

    ie: HTTP/1.1 404 Not Found

    Hope it helps.

    - Dave

    Thanks Dave,

     

    I will try this and let you know how it goes.

     

    Thanks,

    Rahul

  • RayBucher
    RayBucher
    8 Posts

    Re: converting 200 to 404 http response

    ‏2013-08-09T14:01:43Z  

    Thanks Dave,

     

    I will try this and let you know how it goes.

     

    Thanks,

    Rahul

    Hi all

    Datapower is masking the http status codes by intent. With firmware version 6 there is an MPGW option called

    proxy-http-response. Using it you can disable this annoying masking, especially useful with RESTFul web services when the exact code needs to be reported to the calling client.

    Best regards

    Ray

  • Daviiid
    Daviiid
    289 Posts

    Re: converting 200 to 404 http response

    ‏2014-01-02T14:38:52Z  
    • RayBucher
    • ‏2013-08-09T14:01:43Z

    Hi all

    Datapower is masking the http status codes by intent. With firmware version 6 there is an MPGW option called

    proxy-http-response. Using it you can disable this annoying masking, especially useful with RESTFul web services when the exact code needs to be reported to the calling client.

    Best regards

    Ray

    Hello all

    There is a way to do what Rahul want

    You have to enable process back end error.

    If the http response is not 200, you need to use dp:reject

    In the error rule, you can use this style sheet

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp" exclude-result-prefixes="#all">
        <dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
            <dp:output-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
            <xsl:template match="/">
                    <xsl:variable name="backendRspCode" select="dp:http-response-header('x-dp-response-code')"/>
                    <dp:set-variable name="'var://service/error-protocol-response'" value="substring($backendRspCode,1,3)"/>
                    <dp:set-variable name="'var://service/error-protocol-reason-phrase'" value="substring($backendRspCode,5)"/>
                    <object>
                            <message>
                                    <xsl:copy-of select="/object/message/node()"/>
                            </message>
                    </object>
            </xsl:template>
    </xsl:stylesheet>
    

     

    Updated on 2014-01-03T12:52:40Z at 2014-01-03T12:52:40Z by Daviiid
  • W7VA_Barry_Knapp
    W7VA_Barry_Knapp
    1 Post

    Re: converting 200 to 404 http response

    ‏2014-07-23T19:31:56Z  
    • RayBucher
    • ‏2013-08-09T14:01:43Z

    Hi all

    Datapower is masking the http status codes by intent. With firmware version 6 there is an MPGW option called

    proxy-http-response. Using it you can disable this annoying masking, especially useful with RESTFul web services when the exact code needs to be reported to the calling client.

    Best regards

    Ray

    Thanks Ray!

    RayBucher's post worked for me.  On the AdvancedTab of the MPG set Proxy HTTP Response to "on".

     

    Regards,

    Barry