There's probably a better way so others feel free to jump in but I'll answer the reg exp point you pointed out as strange because I came across the same thing and thought it was a bit of a trap for young players. The docs only just got me over the line in that case so I hope this is helpful to others using regular expressions in Jmeter where they want to match over multiple lines.

By default /n or newline is not included in the dot . special character for regular expressions. This means by default all regular expressions are not multi line expressions.

Adding (?s) to the start of your expression will make it a multi line expressions.

From your example data, if I wanted everything between the results tags I would have the following expression

(?s)<results status="ok">(.*)</results>

That expression will return what is contained in the tags and overcome new lines. You want the outer tags as well & there will also be a variable to use which includes the outer results tags which are part of the matching expression. It will be something like ${xml_0} or ${xml_g1} or something like that assuming the output is assigned to a variable called ${xml}. You can look at the reg exp documentation OR I find it easier to add a debug sampler after the reg expression and discover the variable name by looking at the output of it in view results tree.

Cheers,
Chad

Michael Burbidge wrote:
I have an HTTP request with the following response:

<results status="ok">
   <response>
      <account_id>ceeaf4e3face4dc99afef6399bd5b331</account_id>
      <session_key>K6e0L97HNekLTwv3AaRH</session_key>
      <start_count>927302611</start_count>
<ticket>oDbpwdQOpC0fscaHhZ9mb8HGmO3Y/aJH3mx9jPLutXpOCIjYCzynQuDI55arUhseMKm8NNUQGc063Zc2ml+W1l7Y1vzwhT9E3nhNQ/yIWNLqeEc/nBYfEv/9jwXNitIsB8GG5cW/OeR36xK4WzErvlJp/2pqIiC9fv9KMOxHjukFe1jDvwoaA70x5uvkGkDWcffEvghJBjXmZrfqJvaDZqa4x+QYxKbTjoGgHEn2vOSiudmBa0AWVEsfk83zyQEJrG+xTCKirPy9ODUJRQIilR1C6xF39oxCIVOpA82DuUU=</ticket>
      <ticket_nonce>_PmVicRYhmkRPr7eMnKq</ticket_nonce>
   </response>
</results>

I need this entire response stored in a variable as a string, so that I can pass it into another HTTP Request.

I tried creating an XPath Extractor with the XPath "/results". But it sets the variable to the empty string.

I also tried using a regular expression extractor with the regular expression "(.*)" and the template $1$. It set the variable to "<session_key>K6e0L97HNekLTwv3AaRH</session_key>". That seems really strange to me.

Is there anyway to get the entire response of an HTTP Request in a variable so that I can use it later?

Michael-

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Anthony Chadszinow
MySource Classic Lead Developer

Squiz
92 Jarrett St Leichhardt, Sydney NSW, Australia 2040 t: 13000 SQUIZ ( Support )
t:    8507 9900 / 1300 130 661
f:    8507 9988
e:    [EMAIL PROTECTED]
w:    www.matrix.squiz.net
w:    www.squiz.net

Sydney | Melbourne | Canberra | Hobart | Wellington | London Open Source - Own it - Squiz.net
----------------------------------------------------

IMPORTANT:This email (and any attachments) is commercial-in-confidence and
or may be legally privileged and must not be forwarded, copied or shared
without express permission from Squiz. If you are not the intended
recipient, you may not legally copy, disclose or use the contents in any way
and you should contact [EMAIL PROTECTED] immediately and destroy this message and any
attachments. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to