Forum Discussion

Marco_Hernandez's avatar
Marco_Hernandez
Icon for Nimbostratus rankNimbostratus
Jun 19, 2015

XML answer inspection

Hi: I am quite new in this F5 business and iRules. After reading several sols and documents I have clear in my mind the steps I should do to achieve my goal but there is something I could not find.

 

There is something called XML_CONTENT_BASED_ROUTING but I understand this only works for REQUESTS, but I am not sure if it works for reading XML ANSWERS.

 

I understand that when XML Profile is matched in a Virtual Server the iRule and the XML_CONTENT_BASED_ROUTING are triggered so I can read the queries and values The question is, will the XML Profile will be matched also in the ANSWERS? What I want to do is to implement a kind of monitor based on the error codes specified inside the answered XML.

 

Thank you very much

 

2 Replies

  • XML_CONTENT_BASED_ROUTING will parse incoming requests and extract up to 3 elements based on the querystrings you provide. The advantage is that it handles the XML parsing, querying, and extraction for you.

     

    It does not run against the response. You can still achieve your goal using string matching against the response data instead of XML element extraction. Since the response is your server's output, it's probably pretty predictable, making string matching more reliable than it might be on incoming requests from random clients (e.g., you don't need to worry if it's going to be instead of ).

     

    You'll need to collect the response (some example code in HTML Comment Scrubber or HTTP Payload Collection) and then look for your string in the response data:

     

    when HTTP_RESPONSE_DATA {
        if {[HTTP::payload] contains {5}} {
             implement monitor code
        }
    }
  • Thanks a lot Greg. Your explanation and the added references will help us in our issue.