I have an XPATH expression in a Request Mapping that selects an element based on an Attrubute value:
/rcbi:ini/rcbi:Message/rcbi:Parameters[@Env='PRD']
Rather than a hard coded value I want to perform the selection based on the value of a Message Header:
${esbmsg.headers['Environment']}
Is it possible to code the XPATH to perform the selection based on the "Environment" header? (I can easily move the value to be a Message part if that is preferable).
Thanks
Steve
Hi Steve,
EL expressions are currently not supported in the XPath expression in message mapping. I will log an enhancement request for this.
Thanks
-Mahesh
Thanks Mahesh
Can you suggest a way to perform the selection?
I have tried with XSLT but, again, I don't know how to use a Message Part as the comparison value.
Regards
Steve
Hi Steve,
With message mapping you have to use a static xpath for now. The same holds true with the transform action in message mapping as we have not yet exposed XSLT parameters. So some options (none very attractive):
- Create separate steps with message mapping xpaths relevant to each environment and then use a CBR step to route to the appropriate step.
- Use the transformation service where you can pass sytlesheet parameters as a runtime parameter. Then populate these runtime parameters in message mapping.
- Write a custom service
Thanks
-Mahesh
Hi Mahesh
Can you help me out with this one:
- Use the transformation service where you can pass sytlesheet parameters as a runtime parameter. Then populate these runtime parameters in message mapping.
Should I do it the same way as for the Dynamic URL ( #{esbp.params['SomeRuntimeParam']} where in the stylesheet)?
I tried it and got this error:
com.sonicsw.esb.expression.ExpressionException: Failed to evaluate and set expression: #{esbp.params['Environment']}
Thanks
Steve