Citrix protocol - recording via a Citrix Storefront

Hi - Do you have any tips on recording accessing a Citrix desktop via Citrix Storefront? I'm trying to record accessing a Citrix desktop via a storefront, but I can't see how to do this. If I try and use the ICA file that's generated when I access the application manually via the storefront, and use that in the recording, instead of launching in the eggPlant Performance Citrix recorder window, it launches Citrix Receiver, but then just shows "connecting". The event logs on the Citrix server just show that a connection has been dropped.

If I use the same ICA file outside of EPP i.e. clicking on it manually, it launches the desktop.

Edit: I think the problem is probably related to this - I'm trying to log on to a Citrix desktop, but it looks like the authentication around this is different to when just running a Citrix published app.

http://discussions.citrix.com/topic/274967-use-ica-file-repeatedly/

Comments

  • Tom MiseurTom Miseur ForumAdmin, Member admin
    James' question was handled through support, but in case anyone else had the same question, this is the approach for handling Citrix when applications/desktops are accessed through the StoreFront:

    1. Use the Web VU to record the HTTP interaction with the StoreFront

    With recent versions of Citrix, the ICA file is still present but it is now dynamically-generated by the StoreFront web interface. Re-usable ICA files are more or less a thing of the past. As such, one needs a web script to simulate that dynamic generation. The resulting ICA file can also not be re-used, and so it is necessary to use this web script in order to start the Citrix recorder as well.

    2. Store the dynamically-generated ICA file for later use

    Once the Web script is up and running (you may need to perform a few correlations, in particular for a "CSRFToken" that manifests as both an HTTP header *and* cookie), the ICA needs to be stored in a location where the Citrix VU can later pick it up.

    One way to do this is as follows:
    SetString("icaFilePath", FilesDataPath + "\\" + VU.Index + ".ica");
    

    This sets up a unique path for where to save the ICA file. FilesDataPath will work regardless of where you run your test, in other words it'll work on remote injectors as well as localhost. VU.Index is unique per VU group (unlike VU.UniqueId which is unique across the whole test, but is actually not desirable in this case).

    Once you locate the request that results in the ICA file response (look for a Content-Type: application/x-ica header), the entire response can be saved as the ICA file as per the below example:
    using (Response response94 = request94.Send())
    {
    	#region EPP_AFTER_RESPONSE_RECEIVED for Request 94
    
    	// Any code added here will be preserved between regenerations of this script
    
    	#endregion EPP_AFTER_RESPONSE_RECEIVED for Request 94
    
    	// Rule: Verify that the result code matches what was recorded
    	response94.VerifyResult(HttpStatus.OK, ActionType.ACT_WARNING);
    
    	WriteMessage("ICA response (double-click):\r\n" + response94.Content);
    
    	// TM - write it to a temp file:
    	System.IO.File.WriteAllText(GetString("icaFilePath"), response94.Content);
    }
    

    3. Make the Citrix VU wait for the ICA to become available

    This can be achieved using the following two methods. These can be put in a script or the custom VU:
    private void pollForIca(string path)
    {
    	int counter = 0;
    	int pollFrequency = 5000;
    	int maxWait = 60000; // 60 sec
    
    	while (counter <maxWait>= maxWait)
    	{
    		throw new System.IO.FileNotFoundException(String.Format("No ICA file found after {0}ms. Check the results of the Web VU for errors.", maxWait), path);
    	}
    }
    
    private void fetchAndDeleteIca(string path)
    {
    	// load properties individually
    	foreach (string line in System.IO.File.ReadAllLines(path))
    	{
    		if (line.Contains("[") || line.Contains("]") || line.Length == 0)
    		{
    			continue;
    		}
    		else
    		{
    			string property = line.Substring(0, line.IndexOf("="));
    			string value = line.Substring(line.IndexOf("=") + 1);
    			SetIcaProperty(property, value);
    		}
    	}
    
    	// delete the file
    	WriteMessage("Deleting ICA file...");
    	FlushEventLog();
    	File.Delete(path);
    }
    

    Your Citrix script would then make use of these methods as follows:
    pollForIca(GetString("icaFilePath")); // this line blocks until the ICA file has been created by the Web VU
    
    StartCitrixClient(1024, 768);
    
    fetchAndDeleteIca(GetString("icaFilePath")); // once the ICA properties are loaded, the ICA file can be deleted
    
    Connect();
    
    StartTransaction("Connect To Citrix");
    WaitForEvent(CitrixEventType.Connected);
    EndTransaction("Connect To Citrix");
    
  • Tom MiseurTom Miseur ForumAdmin, Member admin
    edited August 2018
    Eggplant Performance 8.0 introduced new functionality that allows the Citrix VU to generate ICA files from the StoreFront without also requiring a Web VU for each Citrix session. Read more about the functionality here.
Sign In or Register to comment.