JMeter - How to extract values from a response which has been decoded from base64 and stored in a variable? All under the same sampler
<p>I am trying to test a webservice's performance, and having a few issues with using and passing variables. There are multiple sequential requests, which depend on some data coming from a previous response. All requests need to be encoded to base64 and placed in a SOAP envelope namespace before sending it to the endpoint. It returns and encoded response which needs to be decoded to see the xml values which need to be used for the next request. What I have done so far is:</p>

<p>1) Beanshell preprocessor added to first sample to encode the payload which is called from a file. 
2) Regex to pull the encoded response bit from whole response.
3) Beanshell post processor to decode the response and write to a file (just in case). I have stored the decoded response in a variable 'Output' and I know this works since it writes the response to file correctly.
4) After this, I have added 4 regex extractors and tried various things such as apply to different parts, check different fields, check JMeter variable etc. However, it doesn't seem to work.</p>

<p>This is what my tree is looking like.</p>

<p><a href="https://i.stack.imgur.com/kpLD1.png" rel="nofollow noreferrer">JMeter Tree</a></p>

<p>I am storing the decoded response to 'Output' variable like this and it works since it's writing to file properly:</p>

<pre><code>import org.apache.commons.io.FileUtils;
import org.apache.commons.codec.binary.Base64;

String Createresponse= vars.get("Createregex");
vars.put("response",new String(Base64.decodeBase64(Createresponse.getBytes("UTF-8"))));

Output = vars.get("response");

f = new FileOutputStream("filepath/Createresponse.txt");
p = new PrintStream(f); 
this.interpreter.setOut(p); 
print(Output);
f.close();
</code></pre>

<p>And this is how I using Regex after that, I have tried different options:</p>

<p><a href="https://i.stack.imgur.com/CaOwi.png" rel="nofollow noreferrer">Regex settings</a></p>

<p>Unfortunately though, the regex is not picking up these values from 'Output' variable. I basically need them saved so i can use ${docID} in the payload file for next request.</p>

<p>Any help on this is appreciated! Also happy to provide more detail if needed.</p>

<p>EDIT: </p>

<p>I had a follow up question. I am trying to run this with multiple users. I have a field ${searchuser} in my payload xml file called in the pre-processor here.</p>

<p><a href="https://i.stack.imgur.com/JhdMQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JhdMQ.png" alt="File call in tree"></a></p>

<p>The CSV Data set above it looks like this:</p>

<p><a href="https://i.stack.imgur.com/LHyB0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LHyB0.png" alt="CSV Data set"></a></p>

<p>However, it is not picking up the values from CSV and substituting in the payload file. Any help is appreciated! </p>