Forum Discussion

Eric_Frankenfie's avatar
Eric_Frankenfie
Icon for Nimbostratus rankNimbostratus
Nov 30, 2013

XML Content Based Routing

I am trying to configure my LTM to send VS requests to a specific pool based on the content of an XML document. The XML contains an 'orgName' which is essentially a customer identification number. I want to compare the orgName with the contents of a data group and if there is a match send the request to pool_A else send the request to the pool_B.

 

Any help would be greatly appreciated!

 

  • I was able to get the XML profile to work by changing the path query to all lowercase.

     

  • I modified the XML profile to search for 'sample' and removed the namespace definition. Passing 'sample' in the request resulted in a match. The issue appears to be with the namespace definition.

     

    My namespace is abc:orgName

     

    The hierarchy of the XML document is... soapenv:Body abc:level1 abc:level2 abc:orgName

     

    Does the hierarchy matter or do I only need to define the abc namespace?

     

  • Are there any logs I can inspect to view the inspected XML documents? The issue appears to be with the XML profile itself.

     

  • Can someone tell me what the URL in the namespace mapping is used for? Does the LTM reach out to that URL?

     

    mapping namespace "http://www.abc.com"

     

  • I have modified my XML profile as follows:

    profile xml Routing_by_Org
      defaults from XML
      namespace mappings {
        mapping prefix "abc"
        mapping namespace "http://www.abc.com"
        }
      path queries "//abc:orgName/*"
    

    I am still not seeing any matches in the statistics. Also, my iRule does not appear to trigger.

    This is the iRule

    when XML_CONTENT_BASED_ROUTING
    {
    log local0. "XML Detected"
    for (set i 0) { $i < $XML::count } {incr i} {
    log local0. $XML::queries($i)
    log local0. $XML::values($i)
    if { ([matchclass [$XML::values($i) equals Routing_by_Org])} {
    pool pool_A
    }
    }
    }
    

    The first logging event on line three never ocurrs which leads me to believe the event on line one is never triggered.

  • I have created the XML profile and applied the profile to the VS. However, when I check the profile statistics by navigating to Overview | Statistics | Local Traffic | Profile Summary | XML I am only seeing documents with no matches.

     

    This is the XML profile I created.

     

    profile xml Routing_by_Org defaults from xml namespace mappings { mapping prefix "abc" mapping namespace "xmlns:abc" } path queries "//abc:orgName"