DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Reading the incoming headers in xslt and pass it to dp:url-open

    Posted Mon October 07, 2024 07:58 PM

    Hi All,

    I have a requirement to pass the all incoming headers(we don't know which headers client is sending) to dp:url-open in xslt/

    I have tried to read the incoming header names using the service variable(var://service/header-mainfest) as below.

    <xsl:variable name="IncomingHeaders" select="dp:variable('var://service/header-mainfest')"/>

    <xsl:variable name="IncomingHeaderswithValues">

    <xsl:for-each select=$IncomingHeaders/headers/header">

    <xsl:variable name="headername" select="@name"/>

    <xsl:variable name="headervalue" select="dp:http-request-header('headername')"/>

    <header name="$headername"> <xsl:value-of select="$headervalue"/> </header>

    </xsl:for-each>

    </xsl:variable>

    but i'm unable to get the header values, do we have any other way to read the incoming headers dynamically. Thanks in advance!

     



    ------------------------------
    bhargav chaluvadi
    ------------------------------


  • 2.  RE: Reading the incoming headers in xslt and pass it to dp:url-open

    Posted Tue October 08, 2024 02:14 AM

    Why do you have to use url-open? Every DataPower service would automatically pass the incoming headers to its configured backend. 
    If you have to, have a look at dp:get-metadata()

    Ibm remove preview
    dp:get-metadata()
    Fetches metadata for the current transaction.

     



    ------------------------------
    Pierce Shah
    ------------------------------



  • 3.  RE: Reading the incoming headers in xslt and pass it to dp:url-open

    Posted Tue October 08, 2024 09:41 AM
    Edited by Steve Linn Tue October 08, 2024 09:41 AM

    Hi Bhargav,
    Your statement

    <xsl:variable name="headervalue" select="dp:http-request-header('headername')"/>

    is setting variable headervalue to the request header named by the string literal 'headername' which probably doesn't exist.  I believe you meant to use the headername variable value as the name of the header you want to get the value

    <xsl:variable name="headervalue" select="dp:http-request-header($headername)"/>

    Best Regards,

    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------