Share this page

# Parse URLs

For a list of protocols that support asynchronous communication, see 64-bit recording, Async, and IPv6 support.

URLs that are included in asynchronous conversations often include query strings that are derived in a variety of ways. These strings may include:

- Time-stamps
- Counters
- Complex strings

To enable a Vuser script to successfully perform asynchronous communication, VuGen must be able to recreate the required URLs.

- When the URL includes a time-stamp, VuGen is usually able to successfully create the required URL.
- When the URL includes a counter, VuGen is usually able to recreate the counter, but it may be necessary to manually initialize the counter in the script.
- When the URL includes more complex strings, the algorithms for generating the URLs must be manually added to the code in the Vuser script.

### Example: A long-poll conversation

The sample code below shows a set of URLs that are part of a long-poll conversation. The URLs are included in the comment generated for a web_reg_async_attributes step:

The following urls are considered part of this conservation:

http://www.example.com/example.aspx?message=helloaaa&iteration=1&timestamp=1324389551431

http://www.example.com/example.aspx?message=hellobbb&iteration=2&timestamp=1324389555643

http://www.example.com/example.aspx?message=hellocc&iteration=3&timestamp=1324389558664

http://www.example.com/example.aspx?message=helloddd&iteration=4&timestamp=1324389560113

If none of the parameters shown in the code sample above was found in VuGen's scan of the recorded Vuser script, the RequestCB implementation contains a snippet that may be uncommented in order to set the URL for each response according to user defined code. For details, see Modify callbacks.

// call web_util_set_request_url() here to modify request url:

// web_util_set_request_url("<request url>");

If any or all of the parameters shown in the sample code above are found during VuGen's scan of the recorded Vuser script, the RequestCB implementation contains the following:

- A comment prompting the user to call web_util_set_request_url. The comment contains a parameterized version of the URL.
- For each time-stamp parameter found in the URL, a snippet for saving the time-stamp to a parameter.
- For each counter parameter found in the URL, a snippet for incrementing a counter parameter. A matching step for initializing the counter parameter is also added to the Action file. The snippet also contains examples of the URL token containing the counter parameter, as seen during the recording.
- For each complex string parameter found in the URL, a snippet for saving the string to a parameter. It is up to the user to generate the correct string to be saved to the parameter to be used in the URL. The snippet also contains examples of the URL token that is considered an unknown parameter, as seen during the recording.
- A snippet for passing the parameterized version of the URL to the web_util_set_request_url function.

### Example: A snippet containing the parameterized version of a URL

// call web_util_set_request_url() here to modify polling url

// url is expected to be of the form:

// http://www.example.com/example.aspx?message={Unknown_LongPoll_0_0}

// &iteration={Counter_LongPoll_0_1}&timestamp={Timestamp_LongPoll_0_2}

### Example: A snippet prompting the user to set the value of an unknown parameter

// TODO - implement parameter of type unknown: Unknown_LongPoll_0.

// Known examples for Unknown_LongPoll_0:

// message=[("channel":"\meta\connect","connectionType":"long-polling","id":3,"clientId":"113fcd4")];

// message=[("channel":"\meta\connect","connectionType":"long-polling","id":5,"clientId":"113fcd4")];

// message=[("channel":"\meta\connect","connectionType":"long-polling","id":6,"clientId":"113fcd4")];

// message=[("channel":"\meta\connect","connectionType":"long-polling","id":7,"clientId":"113fcd4")];

1r_save_string("[\\"channel\":\"\\/meta\\/connect\",\"connectionType\":\"long-polling\",\"id\":3,\"clientId\":\"113fcd4\"]]";

"Unknown_LongPoll_0.0");

### Example: A snippet for incrementing a counter parameter

// TODO - check counter initialization for Counter_LongPoll_0_1 in Action file.

// Known examples for the token containing Counter_LongPoll_0_1:

// iteration=1, iteration=2, iteration=3, iteration=4 gPoll_0_1:

lr_param_increment("Counter_LongPoll_0_1", "(Counter_LongPoll_0_1)");

### Example: A snippet for initializing a counter parameter

lr_save_int(0, "Counter_LongPoll_0_1");

### Example: A snippet for saving a timestamp parameter

web_save_timestamp_param("TimeStamp_LongPoll_0_2", LAST);

### Example: A snippet for passing the parameterized version of a URL to the web_util_set_request_url function

// once all parameters have been assigned, copy them to the updated url,

// and call web_util_set_request_url() with the updated url:

web_util_set_request_url("http://www.example.com/example.aspx?message={Unknown_LongPoll_0_0}

&iterations={Counter_LongPoll_0_1}&timestamp={TimeStamp_LongPoll_0_2}");

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 26.1-26.3 All View Local Help Center View Online Help Center Version: