Forum Discussion
Chris_Schaerli_
Nimbostratus
Jun 18, 2007Tracking session in soap header?
I have been going though the board looking for something to help me with a session persistence issue. I have some transactions I need to set persistence on and I can’t use source IP or cookie. The only thing I have been able to find is a value in the soap header that is unique per session. I have not been able to figure out how to pull that out.
Can anyone suggest a place to start? Here is a snip of the soap header. I need to track on the “soapenc” value.
Jz8rPz8/eAVeJT8/Pz8/KT8/PzA/BD8/Pxd4Pz9LPxg/P2M/Pz8/Pz8/P1I/LT8rP18=
- Deb_Allen_18Historic F5 AccountIf the value will be in each request in the same general format, you could use a rule like this one:
when HTTP_REQUEST { collect the payload containing the POST data HTTP::collect [HTTP::header Content-Length] } when HTTP_REQUEST_DATA { persist on data from 59th character following 'xmlns:soapenc=' up to "<" and follow existing persistence record or create a new one persist uie [findstr [HTTP::payload] "xmlns:soapenc=" 58 "<" }
- Chris_Schaerli_
Nimbostratus
Thanks for the suggestion. I gave it a shot and it is still not working. Is there a way to output the value that the iRule is grabbing to a log? - Colin_Walker_12Historic F5 AccountDeb's rule is close, but missing a closing bracket on the last functional line.
when HTTP_REQUEST { collect the payload containing the POST data HTTP::collect [HTTP::header Content-Length] } when HTTP_REQUEST_DATA { persist on data from 59th character following 'xmlns:soapenc=' up to "<" and follow existing persistence record or create a new one persist uie [findstr [HTTP::payload] "xmlns:soapenc=" 58 "<"] }
when HTTP_REQUEST { collect the payload containing the POST data HTTP::collect [HTTP::header Content-Length] } when HTTP_REQUEST_DATA { persist on data from 59th character following 'xmlns:soapenc=' up to "<" and follow existing persistence record or create a new one persist uie [findstr [HTTP::payload] "xmlns:soapenc=" 58 "<"] log local0. "[findstr [HTTP::payload] 'xmlns:soapenc=' 58 '<']" }
- Chris_Schaerli_
Nimbostratus
Colin, - Chris_Schaerli_
Nimbostratus
The logging did help. I am getting this error "HTTP_REQUEST_DATA - invalid command name findstr" then I see the SOAP message body. So I am guessing the search is not working exactly right. - Chris_Schaerli_
Nimbostratus
I used the Irules editor as well and it didn't have any issues saving. - Deb_Allen_18Historic F5 AccountYou're just missing the whitespace after the findstr command in your log line.
log local0. [findstr [HTTP::payload] xmlns:soapenc= 58 <]
- Deb_Allen_18Historic F5 AccountActually was just testing findstr for another iRule and discovered that single quotes in the findstr command are taken literally, rather than as delimiters, meaning that the match will fail if the search string is delimited with single quotes, and the match will extend to the end of the string if the termination character is delimited with single quotes (neither being the intended result.)
- Chris_Schaerli_
Nimbostratus
I was able to get the session value for the request, but now I also need to get the data for the response post. - Chris_Schaerli_
Nimbostratus
Should I split this into two different IRules one for request and the other for response?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects