API Connect

API Connect

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.  message.status.reason context getting error in XSLT

    Posted Thu December 01, 2022 06:13 AM
    Edited by kandula nagababu Thu December 01, 2022 07:03 AM
    Hi All,

    When I read the "message.status.reason" variable using xslt it is not showing the value in the logs and getting internal Error in logs are pointing to this context variables.
    but whenever I call the entire "message" context it is showing the value of reason "OK".
    and it is working fine without printing in logs this issue coming for (message.status.reason, error.name, api.properties, apigw:get-error()) .

    Please check and tell me the solution.

    ------------------------------
    kandula nagababu
    ------------------------------


  • 2.  RE: message.status.reason context getting error in XSLT

    Posted Fri December 02, 2022 10:49 AM

    Hi Kandula,

    I need some more detail on what you're seeing.  Are you using

    <xsl:variable name="code" select="apigw:get-variable('message.status.code')"/>
    <xsl:variable name="reason" select="apigw:get-variable('message.status.reason')"/>

    and you're getting an error in the logs? Please share your exact code and the log messages being seen.

    Best Regards,

    Steve Linn



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



  • 3.  RE: message.status.reason context getting error in XSLT

    Posted Wed February 22, 2023 07:32 AM
    Edited by Stefen Salvatore Wed February 22, 2023 07:33 AM

    Hi @Steve Linn

    We are trying to store some context variable into a variable as mentioned below.

    look at these two lines.

    <xsl:variable name="OrigRequestPayload"  select="apim.getContext('request.body')"/> "

    "xsl:variable name="OrigRequestPayload"  select="apim.getvariable('request.body')"/>"

     Sometimes apim. is not giving the Response but apigw: is giving the Response in UDP and Error Global Policy also and as well as When I used in code in Assembly also. Why is this happening?


    <xsl:variable name="OrigRequestPayload"  select="apigw:get-variable('request.body')"/> " is giving the Response.


    Please do check: https://community.ibm.com/community/user/integration/discussion/error-while-pushing-user-defined-policy-to-catalog-gateway-policies?ReturnUrl=%2fcommunity%2fuser%2fintegration%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3d2106cca0-a9f9-45c6-9b28-01a28f4ce947

    Thanks and Regards



    ------------------------------
    Vyasavardhan Ramagiri
    ------------------------------



  • 4.  RE: message.status.reason context getting error in XSLT

    Posted Wed February 22, 2023 04:32 PM

    Hi Vyasavardhan,

    Looking at these two lines of code.

     <xsl:variable name="OrigRequestPayload"  select="apim.getContext('request.body')"/>
     <xsl:variable name="OrigRequestPayload"  select="apim.getvariable('request.body')"/>"

    First, in xslt an extension function is defined and thus called with an optional namespace, a colon (if the namespace is present) and the function name, so the period in apim.getContext in not correct. I'm surprised at a minimum you're not seeing an error in the DataPower logs much less a runtime error.

    Also, the apim extension function for the 2nd statement is apim:getVariable, ie the function name has an upper case V, so please try these statements:

    <xsl:variable name="OrigRequestPayload"  select="apim:getContext('request.body')"/>
    <xsl:variable name="OrigRequestPayload"  select="apim:getVariable('request.body')"/>

    My apologies for not noticing that in the referenced link.

    Best Regards,
    Steve



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