Jump to content
Welcome to our new Citrix community!

Content Switch Rule using XPATH not working


Recommended Posts

Per Citrix Documentation I am trying to write rule on the Request Body which contains XML. 

 

Using  Firmware :  NetScaler NS12.0: Build 61.8.nc

 

XML Example:

<OTA_VehAvailRateRQ xmlns:xsi="http://www. w3.org/2001/XMLSchema-instance" xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.008" MaxResponses="51">

<POS>

<Source ISOCountry="US" AgentDutyCode="MMQQ998877">

<RequestorID Type="4" ID="MQ87TH1">

<CompanyName Code="ZZZZZZZ" CodeContext="SSSSSSS"> </CompanyName>

</RequestorID>

</Source>

<Source>

<RequestorID Type="56512" ID="1224A1234"> </RequestorID>

</Source>

</POS>

</OTA_VehAvailRateRQ>

 

I am looking for ISOCountry="US", if the value is "US" we will route to a different backend server. However, I can not get the rule to work. I have tried all different ways.

 

Example of Rule: set cs policy csPol_ISOCountry -rule "HTTP.REQ.BODY(5000).XPATH(xp%//Source/@ISOCountry%).EQ(\"US\")"

 

No matter what XPATH I use it does not work.

 

If I write a rule like: set cs policy csPol_ISOCOuntry -rule  q/HTTP.REQ.BODY(5000).CONTAINS("ISOCountry=\"US\"")/

It will find the string.

 

How can I get this to work with XPATH.

 

 

Link to comment
Share on other sites

  • 2 months later...
On 6/10/2019 at 3:03 PM, Randy Hilburn said:
 
 
 
 
 
 
4
On 6/10/2019 at 3:03 PM, rhilbur80 said:

Per Citrix Documentation I am trying to write rule on the Request Body which contains XML. 

 

Using  Firmware :  NetScaler NS12.0: Build 61.8.nc

 

XML Example:

<OTA_VehAvailRateRQ xmlns:xsi="http://www. w3.org/2001/XMLSchema-instance" xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.008" MaxResponses="51">

<POS>

<Source ISOCountry="US" AgentDutyCode="MMQQ998877">

<RequestorID Type="4" ID="MQ87TH1">

<CompanyName Code="ZZZZZZZ" CodeContext="SSSSSSS"> </CompanyName>

</RequestorID>

</Source>

<Source>

<RequestorID Type="56512" ID="1224A1234"> </RequestorID>

</Source>

</POS>

</OTA_VehAvailRateRQ>

 

I am looking for ISOCountry="US", if the value is "US" we will route to a different backend server. However, I can not get the rule to work. I have tried all different ways.

 

Example of Rule: set cs policy csPol_ISOCountry -rule "HTTP.REQ.BODY(5000).XPATH(xp%//Source/@ISOCountry%).EQ(\"US\")"

 

No matter what XPATH I use it does not work.

 

If I write a rule like: set cs policy csPol_ISOCOuntry -rule  q/HTTP.REQ.BODY(5000).CONTAINS("ISOCountry=\"US\"")/

It will find the string.

 

How can I get this to work with XPATH.

 

 

based on xpath cheatsheet the syntax might need some corrector

 

//Source[@ISOCountry="US"] or //*[@ISOCountry="US"]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...