0

步骤功能:创建草稿;通过在服务器响应中创建草稿 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." }

请帮忙。

4

2 回答 2

0

很明显,您没有关联所有需要关联的内容。做一些重新录音,看看每个录音的反应有什么不同。

于 2015-10-25T22:25:47.243 回答
0

如果没有完整的脚本,我不能肯定地说,但至少在您的请求中更改以下内容:

“RecContentType=text/xml”到“RecContentType=application/json”

“模式=HTML”到“模式=HTTP”

第一个设置预期的响应内容类型,如果不是 XML,则可能会出现问题。这是假设服务以正确的内容类型响应。

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

于 2015-12-02T11:23:37.703 回答