HTTP/1.1 401 Unauthorized in den Antwort-Headern in Load runner für GET-Anforderungen

Ich bin neu in Load runner , Bin vor bin Problem beim Abspielen des Skripts

LR 12.50

O. S Windows 7 SP2

Protokoll ist Mobil, HTTP/HTML

Aufnahme-Modus Proxy

Lassen Sie mich erklären, mein Szenario

Während der Ausführung folgende Funktion:

  web_custom_request("authenticate", 

        "URL=https://ws-xx.xxx.com/tcs/rest/authenticate?include=user,company",     
        "Method=POST", 
        "Resource=0", 
        "RecContentType=application/json", 
        "Referer=", 
        "Snapshot=t1.inf", 
        "Mode=HTTP", 
        "EncType=application/json",
        "Body={\"password\":\"xxx\",\"username\":\"xxx\",\"version\":\"1.0.40\"}", 
        LAST);

Für die oben genannten POST-Methode , bin erste Reaktion, wie unten

   HTTP/1.1 200 OK\r\n
   Date: Tue, 13 Oct 2015 19:19:21 GMT\r\n
   Server: Apache-Coyote/1.1\r\n
   Content-Type: application/json\r\n
   Set-Cookie: dtCookie=DBE9311E44E5C47902702DC762030583|TXlBcHB8MQ; Path=/;
   Domain=.xxx.com\r\n    
   Connection: close\r\n
   Transfer-Encoding: chunked\r\n

Was in Ordnung ist ,Nun die zweite benutzerdefinierte Anforderung wird nachfolgend gezeigt

  web_custom_request("profiles", 
        "URL=https://ws-test.xxx.com/tcs/rest/profiles", 
        "Method=GET", 
        "Resource=1", 
        "RecContentType=application/json", 
        "Referer=", 
        "Snapshot=t2.inf", 
        LAST);

Für die oben genannten GET-Anforderungen in der replay-Protokolle erhalte:

401 unauthorized Fehler.

 GET /tcs/rest/profiles HTTP/1.1\r\n

     User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT)\r\n

    Accept: */*\r\n

    Connection: Keep-Alive\r\n

     Host: ws-test.xxx.com\r\n

   Cookie: dtCookie=DBE9311E44E5C47902702DC762030583|TXlBcHB8MQ\r\n
\r\n
 t=5921ms: 172-byte response headers for "https://ws-test.xxx.com/tcs/rest/profiles" (RelFrameId=1, Internal ID=2)

    HTTP/1.1 401 Unauthorized\r\n

   Date: Tue, 13 Oct 2015 19:19:22 GMT\r\n

   Server: Apache-Coyote/1.1\r\n

   Content-Type: application/json\r\n

    Connection: close\r\n

    Transfer-Encoding: chunked\r\n
   \r\n

t=5922ms: 4-byte chunked response overhead for "https://ws-test.xxx.com/tcs/rest/profiles" (RelFrameId=1, Internal ID=2)
    8b\r\n

 t=5923ms: 139-byte chunked response body for "https://ws-test.xxx.com/tcs/rest/profiles" (RelFrameId=1, Internal ID=2)
     {"errors":[{"message":"Authentication required to access endpoint","status":"401","code":"



 NotAuthenticated","header":"Not Authenticated"}]}

Ich begutachtete dieser link.

Meinem Verständnis von der oben genannten benutzerdefinierten Anfrage , Anmeldung ist der Erfolg, sondern die nächsten
nachfolgende Anforderungen sind immer gescheitert.

Habe ich verwendet web_cleanup_cookies () - Funktion, aber nicht das Problem zu lösen .

Ich habe versucht, die Cookie-ID, anhand der folgenden Funktion

web_reg_save_param("COOKIE_ID",
                        "LR= Cookie: dtCookie=" ,
                        "RB= |TXlBcHB8MQ\r\n",
                        "Ord=All",
                        "RelFrameId=1",
                        "Search=All",
                        LAST);

web_add_header("Cookie",lr_eval_string("{COOKIE_ID}"));

Nun Frage ist, wo parameter "COOKIE_ID" in meinem Skript gibt es zwar

keinen Wert im Skript für COOKIE_ID?

Wie damit umgehen ? Kann jemand mir bitte helfen .

InformationsquelleAutor Prabhakar Y | 2015-10-14
Schreibe einen Kommentar