Topic
  • 5 replies
  • Latest Post - ‏2013-05-13T04:04:29Z by willvk8
willvk8
willvk8
3 Posts

Pinned topic Service variables wiped when calling reusable rule?

‏2013-05-06T01:50:49Z |

I am trying to generalise my error rule into a reusable rule so that I can use it across multiple services however my error rule uses the Datapower error service variables to perform lookups and transformations based on the error codes/messages. 

When I create a reusable rule with this error rule and call it, the error service variables are wiped back to default & nulls so my error rules transformations are quite useless. Is this default behaviour or is there a way I can get around this, beyond writing a stylesheet to manually map the required service variables into context variables before calling this rule - I feel like that would be a fairly messy resolution.

Speedy responses appreciated :p

 

Updated on 2013-05-06T01:51:59Z at 2013-05-06T01:51:59Z by willvk8
  • swlinn
    swlinn
    1348 Posts
    ACCEPTED ANSWER

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-08T13:21:59Z  

    I've seen this behavior too, that when you do a call action from the error rule, that in the called rule, the var://service/error* variables are all empty.  As my work around, I had a simple stylesheet that was executed before the call action in the error rule to put all of the var://service/error* variables into var://context/error/error* variables, and the called rule looked for the context variables, not the service variables.  I'll look to DP development to indicate whether this is anticipated behavior, but my guess is that when you go down the call stack you get a fresh set of variables.

    Regards,

    Steve

  • sachinRocks
    sachinRocks
    3 Posts
    ACCEPTED ANSWER

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-09T11:27:47Z  

    I have a similar setup running over here and it works as expected. Their is no need to use the context variables or the Call action. Ensure the following:

    1) Error rule is of type Error

    2) Use dp:reject  in your xsl to invoke the error.

    If the issue is still present you may have to send a sample mpg/config.

    Regards,

    Sachin

    Updated on 2013-05-09T11:28:17Z at 2013-05-09T11:28:17Z by sachinRocks
  • willvk8
    willvk8
    3 Posts

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-08T04:03:43Z  

    I guess there is no easy fix for this situation and this is simply the default behaviour.

  • HermannSW
    HermannSW
    4741 Posts

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-08T06:06:55Z  
    • willvk8
    • ‏2013-05-08T04:03:43Z

    I guess there is no easy fix for this situation and this is simply the default behaviour.

    Can you attach a minimal sample service export for demonstration here?
    (with description on how to trigger what you are interested in)
     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • swlinn
    swlinn
    1348 Posts

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-08T13:21:59Z  

    I've seen this behavior too, that when you do a call action from the error rule, that in the called rule, the var://service/error* variables are all empty.  As my work around, I had a simple stylesheet that was executed before the call action in the error rule to put all of the var://service/error* variables into var://context/error/error* variables, and the called rule looked for the context variables, not the service variables.  I'll look to DP development to indicate whether this is anticipated behavior, but my guess is that when you go down the call stack you get a fresh set of variables.

    Regards,

    Steve

  • sachinRocks
    sachinRocks
    3 Posts

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-09T11:27:47Z  

    I have a similar setup running over here and it works as expected. Their is no need to use the context variables or the Call action. Ensure the following:

    1) Error rule is of type Error

    2) Use dp:reject  in your xsl to invoke the error.

    If the issue is still present you may have to send a sample mpg/config.

    Regards,

    Sachin

    Updated on 2013-05-09T11:28:17Z at 2013-05-09T11:28:17Z by sachinRocks
  • willvk8
    willvk8
    3 Posts

    Re: Service variables wiped when calling reusable rule?

    ‏2013-05-13T04:04:29Z  

    I have a similar setup running over here and it works as expected. Their is no need to use the context variables or the Call action. Ensure the following:

    1) Error rule is of type Error

    2) Use dp:reject  in your xsl to invoke the error.

    If the issue is still present you may have to send a sample mpg/config.

    Regards,

    Sachin

    Thanks, this could resolve my issue. I was triggering my error rule with an

    <xsl:message terminate=yes>

    rather than a dp:reject. I will test using dp:reject and let you know, if I still have issues I will give an example.

    Thankyou for the reponses.