The script runs correctly now that it has been customized. However a problem exists in that every script that will be recorded in the future must be also customized.
HTTP parsing rules enable the Recorder to continue this type of customization automatically in the future-so that recorded scripts can be automatically generated without needing manual customization.
To do this, research must be done into how the session ID can be parsed. The customization offered by TrueLog Explorer offers a good place to begin. It reveals the API call where the session ID first occurs, and boundaries that can be used to parse the session ID.
Using TrueLog Explorer, the first occurrence of the session ID can be located in the HTML code, as shown in the following example.
<script LANGUAGE="JavaScript"> function doProcess(mylink) { scheme="http://"; server="u2"; serverport=""; path="/ShopItV60/"; file="kindofpayment.asp?"; name="348364005"; price="15.9"; choice="CreditCard"; mylink.href=scheme + server + serverport + path + file + "choice=" + choice + "&price=" + price + "&sid=" + name; } </script>
The left boundary ("name=\"") and the right boundary ("\"") identified by TrueLog Explorer seem to be reasonable choices for parsing the session ID. Now an initial version of a HTTP parsing rule can be written for the Recorder.
<?xml version="1.0" encoding="UTF-8" ?> <RecordingRuleSet> <HttpParsingRule> <Name>ShopIt V6.0 Session Id</Name> <Search> <SearchIn>Body</SearchIn> <LB> <Str>name="</Str> </LB> <RB> <Str>"</Str> </RB> </Search> <ScriptGen> <VarName>ShopItSessionId</VarName> </ScriptGen> </HttpParsingRule> </RecordingRuleSet>
This rule file may be saved to the public RecordingRules directory of Silk Performer-so that the rule will be globally available to all projects. The file name doesn't matter, but the file extension ".xrl" must be used. Alternately, if the recording rule is to be used with only one project, the file may be saved to the Documents directory of a Silk Performer project.
ShopIt V 6.0 Session ID's don't appear in HTTP response headers, so it is specified that only response bodies are to be searched (using attribute Search\SearchIn).
The session ID can be found by searching a left boundary. This boundary is specified in the attribute Search\LB\Str. Note that the quote symbol must be encoded in XML using the character sequence """.
A single quote marks the end of session ID's. This is specified in the attribute Search\RB\Str. Here again, the quote character must be encoded.
Finally, specifics regarding how the variable for the parsing result should be named need to be defined. Names are specified using the attribute ScriptGen\VarName.