使用GET方法在Loadrunner中的web_custom_request

时间:2016-06-30 14:08:19

标签: rest get performance-testing database-performance loadrunner

我有一个GET方法的REST服务,其请求通过URL传递。当我在Rest CLient中尝试手动时,我得到了有效的回复,如下图http://i.stack.imgur.com/cJkJS.png所示: -

网址传递: -

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}

但是当我使用web_custom_request尝试使用LR时,我收到内部服务器错误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 Error\r\n
Action.c(3):     X-Backside-Transport: FAIL FAIL,FAIL FAIL\r\n
Action.c(3):     Connection: Keep-Alive\r\n
Action.c(3):     Transfer-Encoding: chunked\r\n
Action.c(3):     Content-Type: text/xml\r\n
Action.c(3):     Date: Thu, 30 Jun 2016 13:28:27 GMT\r\n
Action.c(3):     X-Client-IP: 10.132.132.6\r\n
Action.c(3):     X-Global-Transaction-ID: 12678193\r\n
Action.c(3):     \r\n
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):     fe\r\n
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):     \r\n
Action.c(3):     0\r\n
Action.c(3):     \r\n
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 I格式传递的。有人可以帮助我解决为什么我在LR中收到内部服务器错误,以便在REST客户端获得有效响应。

1 个答案:

答案 0 :(得分:0)

我可能会建议您通过LoadRunner的代理记录器从restClient中记录此对话两次。我怀疑从一些字段和值中可能有未处理的动态数据。具体而言,这些项目会出现在可能需要解决的项目中:

  • requestTransactionID
  • flowSeqNum
  • businessDate

我可以看到前两个元素是动态的,最后一个要求参数超越今天的日期

多次录制时检查值。

你也可能错过了一个标题。当您记录时,请务必记录所有标题以捕获可能缺失的内容。