Highlighted
Contributor.
Contributor.
423 views

web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

Hello!
I have no experience in testing at all, but I need to solve the problem. Maybe you can direct me in the right direction. !?
I can’t figure out how to pass values from arrays correctly.

 

       int arrSize;
      int ord;
      char * flightID;
      web_reg_save_param_ex(
        "ParamName=flightID1",
        "LB=input type=\"hidden\" name=\"flightID\" value=\"",
        "RB=\"",
        "Ordinal=ALL",
        SEARCH_FILTERS,
        LAST);

    arrSize = lr_paramarr_len("flightID1");
    flightID = lr_paramarr_idx("flightID1", arrSize);
    
    for (ord=1; ord <= arrSize; ++ord) {
    lr_save_string (lr_paramarr_idx("flightID1", ord), "flightID");

web_submit_data("itinerary.pl", 
        "Action=tinerary.pl", 
        "Method=POST", 
        "TargetFrame=", 
        "RecContentType=text/html", 
        "Referer=itinerary.pl", 
        "Snapshot=t38.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=flightID", "Value={flightID1}", ENDITEM,
        "Name=.cgifields", "Value={cgifields1}", ENDITEM, 
        "Name=removeAllFlights.x", "Value=74", ENDITEM, 
        "Name=removeAllFlights.y", "Value=6", ENDITEM, 

LAST);

     

Action.c(44): Notify: Saving Parameter "flightID1_1 = 2102962-7-nn"  ".

Action.c(44): Notify: Saving Parameter "flightID1_2 = 210297416-1557-nn"  ".
------
Action.c(44): Notify: Saving Parameter "flightID1_count = 2".
-----
Action.c(59): t=5165ms: 95-byte request body for "n/itinerary.pl" (RelFrameId=1, Internal ID=24)
Action.c(59):     flightID=%7BflightID1%7D&.cgifields=%7Bcgifields1%7D&removeAllFlights.x=74&removeAllFlight
0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

As far as I know you have to code that your self.

Your response contains a variable amount of parameters When you look closely to your response you might see 3 or more sections. {begin}{repeat}{end}. The {repeat} section will contain one of the parameters each and depending on the amount of parameters you have to repeat it a number of times. The result of this should go into the LR-function. Be sure you allocate a large enough buffer (char array) to hold the result.

It all comes down to C-programming, and I do not think that LR has something for it. Find in your organization someone that is fluently in C programming. When you explain our problem and the LR API he will write your code in less than an hour.

Success,

Erik

Signature:
Reward community members who take time to respond and help.

View solution in original post

0 Likes
6 Replies
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution
Not sure what you to achieve here, but you can change {flightID1} to {flightID} in "Name=flightID", "Value={flightID1}", ENDITEM. You need to define the parameter cgifields1 also.
0 Likes
Highlighted
Contributor.
Contributor.

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

I want to do a correlation, insert values ​​from an array into (Action.c(75): t=4361ms: 94-byte request body for "http://127.0.0.1:1080/cgi-bin/itinerary.pl" (RelFrameId=1, Internal ID=24)flightID=%7BflightID1%7D&cgifields=%7Bcgifields1%7D&removeAllFlights.x=74&removeAllFlights.y=6).

cgifields1 not okto.

Action.c(52): Notify: Saving Parameter "flightID1_count = 2".

Action.c(52): Notify: Saving Parameter "cgifields1_count = 2".
Action.c(52): web_url("welcome.pl") was successful, 8917 body bytes, 1913 header bytes, 36 chunking overhead bytes [MsgId: MMSG-26385]
Action.c(64): Notify: Transaction "2_transaction" started.
Action.c(66): Notify: Parameter Substitution: parameter "flightID1_count" = "2"
Action.c(72): Notify: Parameter Substitution: parameter "flightID1_1" = "210296716-84823-nn"
Action.c(72): Value of {flightID1_1}: 210296716-84823-nn
Action.c(72): Notify: Parameter Substitution: parameter "flightID1_2" = "210300786-1556-nn"
Action.c(72): Value of {flightID1_2}: 210300786-1556-nn
Action.c(75): web_submit_data("itinerary.pl") started [MsgId: MMSG-26355]
Action.c(75): Warning: The string 'flightID1' with parameter delimiters is not a parameter.
Action.c(75): Warning: The string 'cgifields1' with parameter delimiters is not a parameter.
Action.c(75): t=4358ms: Already connected [0] to 127.0.0.1:1080 [MsgId: MMSG-26000]
Action.c(75): t=4358ms: 588-byte request headers for "http://127.0.0.1:1080/cgi-bin/itinerary.pl" (RelFrameId=1, Internal ID=24)
Action.c(75): POST /cgi-bin/itinerary.pl HTTP/1.1\r\n
Action.c(75): Content-Type: application/x-www-form-urlencoded\r\n
Action.c(75): Referer: http://127.0.0.1:1080/cgi-bin/itinerary.pl\r\n
Action.c(75): User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko\r\n
Action.c(75): Accept-Encoding: gzip, deflate\r\n
Action.c(75): Accept-Language: ru,en-US;q=0.7,en;q=0.3\r\n
Action.c(75): Accept: */*\r\n
Action.c(75): Connection: Keep-Alive\r\n
Action.c(75): Host: 127.0.0.1:1080\r\n
Action.c(75): Cookie: MSO=SID&1566566471&MSO_ServerErrorsProb&50&MSO_ServerLoadProb&50; MTUserInfo=first
Action.c(75): Name&name1&address2&vrn%2Fleo%2F398008&username&user&hash&82&lastName&name2%0A&address1&pr
Action.c(75): ost69&creditCard&&expDate&%0A\r\n
Action.c(75): Content-Length: 94\r\n
Action.c(75): \r\n
Action.c(75): t=4361ms: 94-byte request body for "http://127.0.0.1:1080/cgi-bin/itinerary.pl" (RelFrameId=1, Internal ID=24)
Action.c(75): flightID=%7BflightID1%7D&cgifields=%7Bcgifields1%7D&removeAllFlights.x=74&removeAllFlights
Action.c(75): .y=6

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

When you define a parameter X and use it with Ordinal=All, LR create multiple parameters like X_1, X_2, ... and X_count.

So when you know that you always get two hits on your parameter, you can then use in your response code like {X_1}, {X_2}.

It gets complicated when the amount of parameters depends on the request you made. Then you have to assemble your response body.

You might put a safeguard your code with

if( lr_paramarr_len("X") != 2 ) {

   lr_error("Unexpected number of parameters X found: %d",lr_paramarr_len("X") );

   lr_abort();

}

Signature:
Reward community members who take time to respond and help.
0 Likes
Highlighted
Contributor.
Contributor.

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

JHF Remmelzwaal, thanks for the answer.
The fact is that this is just the case when the number of parameters depends on my requests. I need to pass all the parameters found to the server. Could you tell me how to do this. can you have an example of execution ?. Is there a function to pass all found parameters to the server?

0 Likes
Highlighted
Contributor.
Contributor.

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution
 
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: web_reg_save_param_ex( "Ordinal=ALL",

Jump to solution

As far as I know you have to code that your self.

Your response contains a variable amount of parameters When you look closely to your response you might see 3 or more sections. {begin}{repeat}{end}. The {repeat} section will contain one of the parameters each and depending on the amount of parameters you have to repeat it a number of times. The result of this should go into the LR-function. Be sure you allocate a large enough buffer (char array) to hold the result.

It all comes down to C-programming, and I do not think that LR has something for it. Find in your organization someone that is fluently in C programming. When you explain our problem and the LR API he will write your code in less than an hour.

Success,

Erik

Signature:
Reward community members who take time to respond and help.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.