无法使用Web http / html

时间:2015-10-24 21:28:38

标签: json correlation loadrunner vugen

步骤功能:草稿的创建;通过在服务器响应中创建草稿ID显示的成功状态

致电:

web_custom_request("draft",
        "URL=https://xxx.yyy.com/__services/v2/rest/draft", 
        "Method=POST", 
        "Resource=0", 
        "RecContentType=text/xml", 
        "Referer=https://xxx.yyy.com/blog/create-post.jspa?containerType=14&containerID=1", 
        "Snapshot=t7.inf", 
        "Mode=HTML", 
        "EncType=application/json; charset=utf-8", 
        "Body={\"objectType\":38,\"draftObjectType\":2020,\"draftObjectID\":137742,\"subject\":\"perf test 2\",\"body\":\"<body><p>test data</p></body>\",\"properties\":{\"publishBar\":{\"container\":{\"objectType\":\"37\",\"objectID\":\"90094\"},\"visibility\":\"all\",\"commentStatus\":\"2\",\"blogPublishOption\":false,\"publishDate\":{\"selectedDate\":\"{p_Date}\",\"selectedHour\":\"1\",\"selectedMinute\":\"0\",\"selectedPeriod\":\"AM\"}}}}", 
        LAST);

数据相关:草案ID;这个电话的回应 数据参数化:selectedDate 剩余价值是不变的

记录回复正文:

{
  "id" : 2814,
  "objectType" : 38,
  "draftObjectType" : 2020,
  "draftObjectID" : 137742,
  "subject" : "perf test",
  "body" : "<body><p>this i</p></body>",
  "modificationDate" : "2015-10-12T13:44:00.854+0000",
  "properties" : {
    "publishBar" : {
      "container" : {
        "objectType" : "37",
        "objectID" : "90094"
      },
      "visibility" : "all",
      "commentStatus" : "2",
      "blogPublishOption" : false,
      "publishDate" : {
        "selectedDate" : "10/13/2015",
        "selectedHour" : "1",
        "selectedMinute" : "0",
        "selectedPeriod" : "AM"
      }
    }
  }
}

重放期间出错:

{ "code" : 500, "message" :com.sun.istack.SAXException2: class java.util.LinkedHashMap nor any of its super class is known to this context.
javax.xml.bind.JAXBException: class java.util.LinkedHashMap nor any of its super class is known to this context." }

请帮助。

2 个答案:

答案 0 :(得分:0)

很明显,你并没有将所有需要关联的内容联系起来。 做一些重新录音,看看每次录音的反应有什么不同。

答案 1 :(得分:0)

如果没有完整的脚本我无法确定,但至少在您的请求中更改以下内容:

“RecContentType = text / xml”改为“RecContentType = application / json”

“Mode = HTML”到“”Mode = HTTP“

第1个设置预期的响应内容类型,如果它不是XML,则可能存在问题。这假设服务使用正确的内容类型进行响应。

2nd将模式设置为HTTP,因为REST API响应通常不需要解析内容。