web_custom_request在Loadrunner中使用GET方法



我有一个REST服务,它是GET方法的请求是通过URL传递的。手动当我尝试在Rest客户端,我得到有效的响应如下图https://i.stack.imgur.com/cJkJS.png:-

URL传递:-

http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}

但同样的事情,当我尝试在LR使用web_custom_request,我收到内部服务器错误500。

    Action()
{
    web_custom_request("web_custom_request",
    "URL=http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}",
    "Method=GET",
    "TargetFrame=",
    "RecContentType=application/x-www-form-urlencoded",
    "Resource=0",
    "Referer=",
    "Mode=HTTP",
     LAST); 
    return 0;
}

LR响应:-

Action.c(3):     HTTP/1.1 500 Internal Server Errorrn
Action.c(3):     X-Backside-Transport: FAIL FAIL,FAIL FAILrn
Action.c(3):     Connection: Keep-Alivern
Action.c(3):     Transfer-Encoding: chunkedrn
Action.c(3):     Content-Type: text/xmlrn
Action.c(3):     Date: Thu, 30 Jun 2016 13:28:27 GMTrn
Action.c(3):     X-Client-IP: 10.132.132.6rn
Action.c(3):     X-Global-Transaction-ID: 12678193rn
Action.c(3):     rn
Action.c(3): t=411ms: 4-byte chunked response overhead for "http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}" (RelFrameId=1, Internal ID=1)
Action.c(3):     fern
Action.c(3): t=411ms: 7-byte chunked response overhead for "http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}" (RelFrameId=1, Internal ID=1)
Action.c(3):     rn
Action.c(3):     0rn
Action.c(3):     rn
Action.c(3): t=416ms: 254-byte chunked response body for "http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}" (RelFrameId=1, Internal ID=1)
Action.c(3):     <?xml version="1.0" encoding="UTF-8"?>n
Action.c(3):     <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><env:Fault><
Action.c(3):     faultcode>env:Server</faultcode><faultstring>Internal Error (from server)</faultstring></e
Action.c(3):     nv:Fault></env:Body></env:Envelope>
Action.c(3): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}"   [MsgId: MERR-26612] Action.c(3): t=433ms: Closing connection [0] to stg-services.star after receiving status code 500   [MsgId: MMSG-26000] Action.c(3): t=433ms: Closed connection [0] to stg-services.star:9375 after completing 0 requests   [MsgId: MMSG-26000]
Action.c(3): t=433ms: Request done "http://stg-services.star:9375/MobileCheckin/rest/KeylessMetrics?serviceRequest={"requestContextBean":{"requestTransactionID":"fa4dfc4b2b5244153e965361fcc8369711b59dad111020fdceafad16aa19","flowSeqNum":"567","globalContextParameters":["globalContext1","globalContext2"],"contextFrames":[{"name":"cfb1","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null},{"name":"cfb2","type":"mci request","serviceInterface":"getResIdsByMetricName","operation":"getResIdsByMetricName","localContextParameters":[],"ipaddress":null}]},"propId":421,"businessDate":"2016-06-30","metricName":["ALL"],"urgentlyWaitingTimeConfig":30}"    [MsgId: MMSG-26000]
Action.c(3): web_custom_request("web_custom_request") highest severity level was "ERROR", 254 body bytes, 256 header bytes, 11 chunking overhead bytes      [MsgId: MMSG-26387]
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

只有从Restclient和LR的变化是在URL的格式我传递。有人可以帮助我为什么在LR中收到内部服务器错误,其中在RESTclient中获得有效响应。

我可能建议通过LoadRunner的代理记录器从您的restClient记录两次此对话。从一些字段和值来看,我怀疑您可能涉及未处理的动态数据。具体地说,这些项在可能需要处理的项中弹出:

  • requestTransactionID
  • flowSeqNum
  • businessDate

我可以看到前两个元素是动态的,最后一个元素需要一个参数来移动到今天的日期之外

多次记录时检查值。

也可能缺少标题。当你记录时,一定要记录所有的标题,以捕获可能丢失的内容。

最新更新