SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Sep 2002
    Posts
    56
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Parameter Substitution in Header .h file not working!

    Hi Folks,

    I am currently recording and saving my LR scripts in .h header files and calling these functions in an LR script (don't ask why, the MIGHTY client rules :-)). But I am currently facing an situation where though a parameter is being correctly substituted, it is not being correctly passed to the page. It sounds silly but the same piece of code works fine when it is run as a script. But when I parameterize it and save it in an header file, it refuses to work. I have narrowed it down to either a strcpy() error or maybe a redirection. Has anybody faced a problem of this sort?

    Would really appreciate any help or hints on this one!! Really, thanks!! :-)

    - oneil

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Livingston (Scotland)
    Posts
    530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Parameter Substitution in Header .h file not working!

    Oneil,

    Why dont you post the piece of code for use to see? May then be able to spot the probelem...

    - Colin
    Hope this helps.

    Regards,
    Colin.

  3. #3
    Member
    Join Date
    Sep 2002
    Posts
    56
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Parameter Substitution in Header .h file not working!

    // This function works fine when it's in a script
    // but fails when it's in a header .h file
    // and when it's parameterized
    ///////////////////////////////////////////////////////////
    function(LPCSTR SubUserID)
    {
    // Initialization code

    // Strcpy call
    char strSubUserID[100]="Value=";
    strcat(strSubUserID,SubUserID);

    // Strcpy functions
    // CreateString is a private function that takes three parameters and concatenates them together
    // using strcpy and strcat functions. We are efficient, aren't we?? ;-)
    strcpy(strAction,CreateString("Action=https://",SSO_PATH,"/siteminderagent/forms/formpost.fcc"));
    strcpy(strReferer,CreateString("Referer=https://",SSO_PATH,"/logon/sso_logon.jsp?LOB=COLLogon"));

    // This is a call to login
    web_submit_data("formpost.fcc",
    strAction,
    "Method=POST",
    "TargetFrame=",
    "RecContentType=text/html",
    strReferer,
    "Mode=HTML",
    ITEMDATA,
    "Name=authmethod", "Value=userpassword", ENDITEM,
    "Name=locale", "Value=en_us", ENDITEM,
    // I am replacing the parameter over here with the variable
    "Name=usr_name", strSubUserID, ENDITEM,
    "Name=usr_password", "Value=r12345", ENDITEM,
    "Name=hiddenuri", "Value=/logon/on_successful_logon.jsp?LOB=COLLogon", ENDITEM,
    "Name=LOB", "Value=COLLogon", ENDITEM,
    LAST);
    }


    Thanks Folks - Oneil

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Livingston (Scotland)
    Posts
    530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Parameter Substitution in Header .h file not working!

    Oneil,

    You don't mention which value you were having the difficulty with in the above code?

    If you suspect it's one of the strcpy lines, have you evaluated the contents after calling your 'CreateString' functions?

    lr_output_message("Action =%s,Referer=%s", strAction,strReferer);

    Let us know if you cracked the problem yet.
    Hope this helps.

    Regards,
    Colin.

  5. #5
    Member
    Join Date
    Sep 2002
    Posts
    56
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Parameter Substitution in Header .h file not working!

    Hi,

    I am having problems with the strSubUserID variable. I did an lr_output_message for Action, Referer and strSubUserID and they are correctly displayed. So I don't think that strcpy is a problem, yet somehow the code is still not working.

    Any help will be appreciated!

    Thanks - Oneil

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Livingston (Scotland)
    Posts
    530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Parameter Substitution in Header .h file not working!

    Oneil,

    The only thing I can think of is perhaps pointers are being overwritten.

    I assume then that the LPCSTR (long string pointer) 'SubUserID' your passing to the function is a loadrunner parameter in the main script?

    As you don't show where/how you've declared your strAction and sReferer, if these are char *(s) possibly the subsequent strcpy statements could be inadvertantly overwritting an area of memory?

    If you haven't already, have you tried evaluating the contents of the strSubUserID variable with an lr_output_message immeadiately prior to your web_submit_data?

    I've seen a similar situation before where I've evaluated the contents of a variable after a strcpy, but subsequent string manipulations have overwritten or lost the value I thought I had.
    Hope this helps.

    Regards,
    Colin.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:06 PM.

Copyright BetaSoft Inc.