IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this forum will no longer be available. More details available on our FAQ.
Topic
  • 4 replies
  • Latest Post - ‏2015-01-05T21:54:14Z by HermannSW
DPOW_developer
DPOW_developer
10 Posts

Pinned topic Tranform 403 page

‏2014-12-16T12:10:13Z | code. http transformation xslt

Hi,

im trying to replace the default 403 Forbidden error page with a custom one.

The transformation is very simple:

 

<xsl:template match="/">

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

  <html>
   <head>
    <title>Page Tile</title>
   </head>
   <body>
    <p>Page Text</p>
   </body>
  </html>

 </xsl:template>

 

The http error code change is working well but the page code that I receive have always a code attached:

<html xmlns:date="http://exslt.org/dates-and-times">
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title>Page Tile</title>
  </head>
  <body>
    <p>Page Text</p>
  </body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">    <<<<<<<-------- What the hell is this?!?!?!?
<html>
  <head>
    <title>403 Forbidden</title>
  </head>
  <body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /test
      on this server.
    </p>
    <hr>
    <address>IBM_HTTP_Server at xxx.xxx.xxx.xxx Port XX</address>
  </body>
</html>

I have check the result code out response rule using the probe and is the code I expect:

<html  xmlns:date="http://exslt.org/dates-and-times">
  <head>
    <title>Page Tile</title>
  </head>
  <body>
    <p>Page Text</p>
  </body>
</html>

 

How can i supress the error mesage?

  • kenhygh
    kenhygh
    2522 Posts

    Re: Tranform 403 page

    ‏2014-12-16T13:33:26Z  

    Have the input context to your transform action be INPUT

  • DPOW_developer
    DPOW_developer
    10 Posts

    Re: Tranform 403 page

    ‏2014-12-16T15:33:08Z  
    • kenhygh
    • ‏2014-12-16T13:33:26Z

    Have the input context to your transform action be INPUT

    Yeah, and in the probe the output of the rule is correct.

  • kenhygh
    kenhygh
    2522 Posts

    Re: Tranform 403 page

    ‏2015-01-05T20:16:24Z  

    Yeah, and in the probe the output of the rule is correct.

    My apologies, the subscription code in devWorks went wonky and I haven't been getting updates. And the web interface is awful.

    'what the hell is this' is the response from the provider server. By default, if you do not have an action that consumes INPUT, it will attach INPUT (the response from the provider) to whatever you generate. Dumb, but we have customers dependent on this behavior so we really can't change it.

    Probe won't show this either :-(

  • HermannSW
    HermannSW
    8729 Posts

    Re: Tranform 403 page

    ‏2015-01-05T21:54:14Z  
    • kenhygh
    • ‏2015-01-05T20:16:24Z

    My apologies, the subscription code in devWorks went wonky and I haven't been getting updates. And the web interface is awful.

    'what the hell is this' is the response from the provider server. By default, if you do not have an action that consumes INPUT, it will attach INPUT (the response from the provider) to whatever you generate. Dumb, but we have customers dependent on this behavior so we really can't change it.

    Probe won't show this either :-(

    Not dumb, but makes sense:
    If backend response type is Non-XML then some action has to consume the backend response.
    If this is not the case then the response type is just wrong.

    The backend response can be consumed by eg. a Transform binary action added anywhere in response rule with

    • input context INPUT
    • output context NULL
    • this XSLT
    <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"
    >
      <dp:input-mapping  href="store:///pkcs7-convert-input.ffd" type="ffd"/>
        
      <xsl:template match="/">
        <xsl:copy-of select="string-length(dp:binary-encode(/object/message/node()))"/>
      </xsl:template>
      
    </xsl:stylesheet>
    

     

    Hermann.