ViewState not being properly converted with web_convert_param (925 Views)
Reply
Advisor
Huma Khan
Posts: 17
Registered: ‎05-27-2008
Message 1 of 5 (925 Views)

ViewState not being properly converted with web_convert_param

Hi,

 

I have a problem where a ViewState value contains a ":-" in the middle of the numerical value and upon replay this converts to "%3A-" which is causing a HTTP 500 Internal Server error.

 

The value is being properly correlated (I can see the correct number being picked up in the run time data. When it is picked up by the correlation it displays the number with the ":-" as per normal. Even the replay log shows the ViewState value with ":-" however when I reuse this correlated value in the script the replay log shows me that the entire ITEMDATA corresponding to this web_submit_data has a series of additional characters where all the ":" are being replaced with "%3A" which leads to the HTTP 500. The script request and subsequent portion of replay log are pasted below for your reference.

 

Script request:

 

    web_convert_param("ViewState01", "SourceEncoding=URL", 
     "TargetEncoding=HTML", LAST );

    web_submit_data("reportsHome.xhtml;jsessionid=3HfFGLhLw3P0S4k8tmzmfLkf.xxxx1", 
        "Action=http://xxxx01.com.au/ofr-web/reports/reportsHome.xhtml;jsessionid={SessionID}", 
        "Method=POST", 
        "RecContentType=text/html", 
        "Referer=http://xxxx01.com.au/ofr-web/reports/reportsHome.xhtml", 
        "Snapshot=t2.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=formParam", "Value=formParam", ENDITEM, 
        "Name=javax.faces.ViewState", "Value={ViewState01}", ENDITEM, 
        "Name=formParam:j_idt40", "Value=formParam:j_idt40", ENDITEM, 
        LAST);

 

 

Replay Log:

 

Action.c(34): t=29659ms: 125-byte request body for "http://xxxx01.com.au/ofr-web/reports/reportsHome.xhtml;jsessionid=W3liYkOlgFgDM9KF282WuOIx.xxxx1" (RelFrameId=1, Internal ID=34)
Action.c(34):     formParam=formParam&javax.faces.ViewState=-1550732358078836610%3A-8754379028001763227&form
Action.c(34):     Param%3Aj_idt40=formParam%3Aj_idt40
Action.c(34): t=29692ms: 252-byte response headers for "http://xxxx01.com.au/ofr-web/reports/reportsHome.xhtml;jsessionid=W3liYkOlgFgDM9KF282WuOIx.xxxx1" (RelFrameId=1, Internal ID=34)
Action.c(34):     HTTP/1.1 500 Internal Server Error\r\n

 

 

The ViewState01 value that has been saved into the run time data is "1550732358078836610:-8754379028001763227", despite it showing the correct value, I am doing a web_convert_param because I can't think of what else to do in order to ensure the colon is not converted to %3A.

 

As you can see in the example, all the formparam values in the ITEMDATA where a colon appears have also been converted to %3A.

 

Does anyone have any ideas on how I might be able to post this request with the colon?

 

I am using LR11.5 (patch LR_03159.EXE) included. The app is a web app written with JSF 2.0 and I am using Web HTTP/HTML protocol.

 

BTW I have a second conversion problem as well whereby a web_custom_request which has a string of data in the "Body" section. This section contains another ViewState value which needs to be replaced with the correlated value. When I replace the ViewState value with the correlated variable, it is simply replayed in the test as text.

 

e.g.

 

"Body=p699Form=p699Form&p699Form%3Aj_idt40%3AcourtAppearance=2883&p699Form%3Ato=1&p699Form%3Adocument=&p699Form%3AissuedComp%3AradioBtn=informantName&p699Form%3AissuedComp%3AdropDownList=24761&p699Form%3AissuedComp%3AinputTxt=&p699Form%3AservedComp%3AradioBtn=informantName&p699Form%3AservedComp%3AdropDownList=&p699Form%3AservedComp%3AinputTxt=&javax.faces.ViewState={CorrelationParameter_2_URL2}&javax.faces.source=p699Form%3Ato&javax.faces.partial.event=change&javax.faces.partial.execute=p699Form%3Ato%20%40component&javax.faces.partial.render=%40component&javax.faces.behavior.event=change&org.richfaces.ajax.component=p699Form%3Ato&AJAX%3AEVENTS_COUNT=1&javax.faces.partial.ajax=true",
        

 

The {CorrelationParameter_2_URL2} is not being replaced with the correlated value.

 

Any help with both these problems would be helpful.

 

 

 

 

 

HP Expert
Editus
Posts: 650
Registered: ‎04-06-2011
Message 2 of 5 (884 Views)

Re: ViewState not being properly converted with web_convert_param

Hello

Check on the function reference, the sample 2 shows the below

web_convert_param(

"targetParam",

"SourceString={param1}abc{param2}",

"SourceEncoding=HTML",

"TargetEncoding=PLAIN",

LAST );

 

try like this, notice the tagetParam is what you use later on the code and not the corraletion parameter.

 

if it still fails, please open a case with support.

 

 

regards

Advisor
Huma Khan
Posts: 17
Registered: ‎05-27-2008
Message 3 of 5 (873 Views)

Re: ViewState not being properly converted with web_convert_param

Hi Editus,

 

Thanks for responding.

 

I've tried your sample code and substituted my correlated values but I still get a HTTP 500 failure.

 

Even though I can see that the value has the colon in it after conversion, for some reason the request that is posted still has the %3A in it. So, maybe the web_convert_param is working but the web_submit_data is still converting all the colon's in the ITEMDATA to %3A. Interestingly though, its not converting any other special charecters, e.g. "-" and "_" are still passed as "-" and "_".

 

I have raised an issue with support for further help.

Regular Advisor
bighead337
Posts: 72
Registered: ‎10-05-2010
Message 4 of 5 (851 Views)

Re: ViewState not being properly converted with web_convert_param

Hi Huma,

I have never seen a web_submit_data function submit the parameter incorrectly. We may be able to help if support has not come up with a solution yet. It would be more helpful is see more of the script's code like where you have the web_reg_save_param.

You can consolidate the convert and parameter functions by adding a Convert argument in the web_reg_save_param. See help on the function for correct syntax.

As for {CorrelationParameter_2_URL2} being used as plain text and not value of the parameter. It is either not being captured correctly or the name of the parameter being captured versus name used might be slightly different.

Advisor
Huma Khan
Posts: 17
Registered: ‎05-27-2008
Message 5 of 5 (849 Views)

Re: ViewState not being properly converted with web_convert_param

Hi,

 

I have had a response from support but its only been partially helpful. They told me to use URL based scripting with both advanced options checked. This increased my script size to over 2500+ lines and it takes over 36 minutes to execute this script once just to debug it. The response times shown by the transactions are also completely incorrect and I've also had to increase the step download timeout value to over 400 seconds as the web_concurrent_end functions in the script were constantly timing out.

 

The correlations work when the script is recorded with URL mode and I don't have to convert the ViewState as it's picked up correctly (with the colon) and replayed by the web_submit_data withouth converting it to %3A. It's just that the time taken to run the script is absurd.

 

Support still cannot provide me with any reason why the HTML recording automatically converts the : to %3A. If it didn't convert it, I wouldn't need to use the web_convert_param function. I've even tried to use the convertion option that is part of the web_reg_save_param but it doesn't help. I can see in the run time data that the value is correlated, converted, but then the %3A is still submitted in the web_submit_data. I don't understand why.

 

Any help you can provide would be great at this stage as time is of the essence.

 

Sample script:

 

    web_reg_save_param ("SessionID",
                        "LB=ofr-web!JSESSIONID=",
                        "RB=; Path", LAST);

 

    web_reg_save_param ("ViewState01",
                        "LB=javax.faces.ViewState\" value=\"",
                        "RB=\" autocomplete", LAST);
    
    web_url("reportsHome.xhtml", 
        "URL=http://yyyy.zzz.com.au/ofr-web/reports/reportsHome.xhtml", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t1.inf", 
        "Mode=HTML", 
        LAST);

    web_reg_save_param ("ViewState02",
                        "LB=javax.faces.ViewState\" value=\"",
                        "RB=\" autocomplete", LAST);
    
/*    web_convert_param("ViewState01_Converted", 
                      "SourceString={ViewState01}",
                      "SourceEncoding=URL",
                         "TargetEncoding=HTML", LAST );
*/


    web_submit_data("reportsHome.xhtml;jsessionid=3HfFGLhLw3P0S4k8tmzmfLkf.yyyy1", 
        "Action=http://yyyy.zzz.com.au/ofr-web/reports/reportsHome.xhtml;jsessionid={SessionID}", 
        "Method=POST", 
        "RecContentType=text/html", 
        "Referer=http://yyyy.zzz.com.au/ofr-web/reports/reportsHome.xhtml", 
        "Snapshot=t2.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=formParam", "Value=formParam", ENDITEM, 
        "Name=javax.faces.ViewState", "Value={ViewState01}", ENDITEM, 
        "Name=formParam:j_idt40", "Value=formParam:j_idt40", ENDITEM, 
        LAST);

 

 

 

Let me know if you need additional information to help resolve this.

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.