Hi - I am trying to get an iRule in place that routes traffic based on XML content. I’ve done this before and it works ok, but this XMl string I have this time contains a namespace (which I’m not sure I understand yet…)
XML string is attached to this topic - I’ve removed the main part of xml to keep it simple:(see attached)
I’ve created the following XML profile and assigned it to the VIP:
profile xml Kobra_User_ID_Check {
defaults from xml
namespace mappings none
xpath queries “//kr:userId”
}
and I have an iRule on the VIP that looks like this:
when XML_CONTENT_BASED_ROUTING {
for {set i 0} { $i < $XML::count } {incr i} {
log local0. $XML::queries($i)
log local0. $XML::values($i)
if {([matchclass $XML::values($i) contains Kobra_migrated_users])} {
pool pool1
}
else {
pool pool2
}
}
}
Oh and a class/data group like this:
class Kobra_migrated_users {
“u94770”
}
Hopefully someone can help, please, I think its related to the namespace mappings and how they are referred to within the xml doc, but am stuck, I’ve tried various combinations, but its not even logging the entry into the ltm log.
Thanks - unfortunately this still does not work with double quotes or \"
I dont see any errors at all, but the rule doesn’t even log the $XML::queries($i) and $XML::values($i) to /var/log/ltm.
I can see the XML profile is at least inspecting the XML document, as the statistics page shows that, but also logs an entry under “Documents with no matches” each time I try an POST the XML to the VIP.
So it seems to me that the XPath query I have specified is not correctly configured, and I thought perhaps the namespace mapping was something to with it?