Forum Discussion

Miley's avatar
Miley
Icon for Nimbostratus rankNimbostratus
Feb 18, 2022

iRule using HTTP Payload on universal persistence profile

Hi All

Seem to have hit a wall, what im trying to achive is to create a persitence record based on the transactionID.

when HTTP_REQUEST {
# Pull all xml data after <name>TransactionId</name><value><string> into variable trans_data
set trans_data [getfield [HTTP::payload 0] "<name>TransactionId</name>
<value>
<string" 2]
# Pull all xml data in trans_data before </string> into variable trans_id
set trans_id [getfield $trans_data "</string>" 1]
# Set trans_id as the value to persist on
persist uie $trans_id
# Write the persistence value to the NLB log (/var/log/ltm)
log local0. "WE RECORDED $trans_id AS THE PERSIST VARIABLE"
}

This pulls the TransactionID from

<?xml version="1.0"?>

<methodCall>

  <methodName>handleUSSDRequest</methodName>

  <params>

    <param>

      <value>

         <struct>

            <member>

              <name>TransactionId</name>

              <value>

                <string>334988643</string>

              </value>

            </member>

it seems to be recording the entry in the log:

Feb 17 16:09:37 info tmm[5600]: Rule /Common/USSDGWtransactionID <HTTP_REQUEST>: WE RECORDED >334988643 AS THE PERSIST VARIABLE

However i cant seem to find the entry in the persestance table and seem to be getting loads of errors:

Feb 18 09:07:43  err tmm[5600]: 01220001:3: TCL error: /Common/USSDGWtransactionID <HTTP_REQUEST> - attempt to use empty persistence key (line 😎     invoked from within "persist uie $trans_id"

Could anyone maybe shed some light on this?

    • Anirban's avatar
      Anirban
      Icon for Nimbostratus rankNimbostratus

      HTTP_REQUEST is used for client sider persistence.

       

      How we can then incorporate server side persistence

      In WHEN HTTP_RESPONSE and in persist add uie <variable>