Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..
4849 views

Disable Mark HTTP Status-Code=401 (Unauthorized) as an Error

Jump to solution

Hi to all,

for my Mobile Application I need that LoadRunner (v 12.02) don't mark as an error the http status code 401.

In fact the first request is:

web_submit_data("init", 
        "Action=http://XXX.YYY.ZZZZ.it:81/Application/apps/services/api/Application/android/init", 
        "Method=POST", 
        "RecContentType=application/json", 
        "Referer=", 
        "Snapshot=t12.inf", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=isAjaxRequest", "Value=true", ENDITEM, 
        "Name=x", "Value=0.7308061446528882", ENDITEM, 
        LAST);

and the correct response is:

HTTP/1.1 401 Unauthorized\r\n
Date: Wed, 10 Aug 2016 14:19:09 GMT\r\n
X-Powered-By: Servlet/3.0\r\n
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV
INT DEM PRE"\r\n
WWW-Authenticate: WL-Composite-Challenge\r\n
Expires: Thu, 01 Jan 1970 00:00:00 GMT\r\n
Cache-Control: no-cache, no-store, must-revalidate\r\n
Pragma: no-cache\r\n
Content-Length: 96\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: application/json; charset=UTF-8\r\n
Content-Language: en-US\r\n
\r\n
714ms: 96-byte response body for "http://XXX.YYY.ZZZZ.it:81/Trenitalia/apps/services/api/Trenitalia/android/init" (RelFrameId=1, Internal ID=1)
/*-secure-\n
{"challenges":{"wl_antiXSRFRealm":{"WL-Instance-Id":"nh991r2o7eduhaefo3ltl74gaq"}}}*

because here I parametrize che "WL-Instance-Id"'s value for switching it in all subsequent requests.

I have tried from Run-Time Settings > Internet Protocol > HTTP > and flag "Mark HTTP errors as warning" but when I reply the script it fails. There is a different method for do this?

Thank you in advance

Ilaria

0 Likes
1 Solution

Accepted Solutions
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Disable Mark HTTP Status-Code=401 (Unauthorized) as an Error

Jump to solution

Hi,

I have found an easy workaround inserting the lr_continue_on_error function in the script for enable and desable the options selected in the RTS only for the selected web_url:

it seems like this:

lr_continue_on_error(1);

web_url("lineadiretta.gruppofs.it", 
        "URL=https://lineadiretta.gruppofs.it/", 
        "TargetFrame=", 
        "Resource=0", 
        "Referer=", 
        "Snapshot=t273.inf", 
        "Mode=HTML", 
        LAST);

lr_continue_on_error(1);

Bye.

Ilaria

View solution in original post

2 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Disable Mark HTTP Status-Code=401 (Unauthorized) as an Error

Jump to solution

Hello,

401 means the server requires authentication. In normal case, it won’t fail script execution. On receiving 401, LR will add authentication header and resend the request.

The issue here in your case is the authentication method: “WL-Composite-Challenge” is not recognized by LR.

Although you can set “RTS->General->Miscellaneous->Error handling->Continue on error” to ignore the error and continue, but I think the server will keeps asking for authentication, so following request won’t success.

I think currently you may have two work around to overcome this issue,

One is change the server to use some classic authentication method, like  “basic”, “ntlm”, “digest”, “negotiate”;

Second, if you are familiar with the detail about WL-Composite-Challenge” process,

Try to use lr_load_dll to load external libraries to process the “Challenges”, then together with correlation functions,  web_add_header, web_customer_request  you may able construct the authentication response by yourself.  

Regards,

Bingle(LoadRunner R&D)

Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Disable Mark HTTP Status-Code=401 (Unauthorized) as an Error

Jump to solution

Hi,

I have found an easy workaround inserting the lr_continue_on_error function in the script for enable and desable the options selected in the RTS only for the selected web_url:

it seems like this:

lr_continue_on_error(1);

web_url("lineadiretta.gruppofs.it", 
        "URL=https://lineadiretta.gruppofs.it/", 
        "TargetFrame=", 
        "Resource=0", 
        "Referer=", 
        "Snapshot=t273.inf", 
        "Mode=HTML", 
        LAST);

lr_continue_on_error(1);

Bye.

Ilaria

View solution in original post

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.