尝试更新用户故事时“无法更新:无法写入工作单元中的更改”错误使用Rally Java Toolkit

时间:2015-05-15 04:18:21

标签: java curl rally

尝试在此处使用java工具包更新Rally中的userstory时:https://github.com/RallyTools/RallyRestToolkitForJava我使用以下代码收到“无法更新”错误。

RallyRestApi restApi = new RallyRestApi(new URI(RALLY_URI), RALLY_APIKEY);
restApi.setWsapiVersion("v2.0");JsonObject updatedDefect = new JsonObject();
updatedDefect.addProperty("c_ProdDeployDate", "20151405");
out.println(updatedDefect.getAsJsonObject());
UpdateRequest updateRequest = new UpdateRequest("https://us1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/24091008142", updatedDefect.getAsJsonObject());
updateRequest.setFetch(new Fetch("Name", "c_buildlink", "c_ProdDeployDate"));
out.println(updateRequest.toUrl());
out.println(updateRequest.getBody());
UpdateResponse updateResponse = restApi.update(updateRequest);
out.println(Arrays.toString(updateResponse.getErrors()));
out.println(updateResponse.wasSuccessful());

这给了我以下输出:

{"c_ProdDeployDate":"20151405"}
/hierarchicalrequirement/24091008142.js?fetch=Name%2Cc_buildlink%2Cc_ProdDeployDate
{"hierarchicalrequirement":{"c_ProdDeployDate":"20151405"}}
[Could not update: Could not write changes in Unit Of Work]
false

基于这个问题:Rally webservices api v 1.36 <OperationResultError>Could not update: Could not write changes in Unit Of Work</OperationResultError> 我试图通过卷曲来做到这一点,没有运气。

curl -X POST -v --header "zsessionid:_APIKEY_OMITTED" -H "Content-Type: application/json" -d "{\"hierarchicalrequirement\":{\"c_ProdDeployDate\":"20151405"}}" https://us1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/24091008142 1>test.txt 2>test2.txt

的test.txt:

{"OperationResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Could not update: Could not write changes in Unit Of Work"], "Warnings": []}}

的test2.txt:

* Adding handle: conn: 0x207d370
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x207d370) send_pipe: 1, recv_pipe: 0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to us1.rallydev.com port 443 (#0)
*   Trying 63.150.172.6...
* Connected to us1.rallydev.com (63.150.172.6) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using RC4-MD5
* Server certificate:
*    subject: businessCategory=Private Organization; 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; serialNumber=3413668; street=3333 Walnut St.; postalCode=80301; C=US; ST=Colorado; L=Boulder; O=Rally Software Development Corp; CN=rally1.rallydev.com
*    start date: 2013-10-22 12:00:01 GMT
*    expire date: 2015-06-03 12:00:00 GMT
*    subjectAltName: us1.rallydev.com matched
*    issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
*    SSL certificate verify ok.
> POST /slm/webservice/v2.0/hierarchicalrequirement/24091008142 HTTP/1.1

> User-Agent: curl/7.30.0

> Host: us1.rallydev.com

> Accept: */*

> zsessionid:_APIKEY_OMITTED

> Content-Type: application/json

> Content-Length: 57

> 

} [data not shown]
* upload completely sent off: 57 out of 57 bytes
< HTTP/1.1 200 OK

< Date: Fri, 15 May 2015 04:11:39 GMT

< RallyRequestID: qd-app-141g7i6j3ih5r0c1s3315892wbdc.qd-app-1414588284

< Expires: Thu, 01 Jan 1970 00:00:00 GMT

< Content-Type: text/javascript;  charset=utf-8

< Content-Length: 156

< Set-Cookie: JSESSIONID=qd-app-141g7i6j3ih5r0c1s3315892wbdc.qd-app-14;Path=/;Secure;HttpOnly

< Set-Cookie: SUBBUCKETID=1;Path=/;Domain=us1.rallydev.com;Secure;HttpOnly

< Vary: Accept-Encoding

< P3P: CP="NON DSP COR CURa PSAa PSDa OUR NOR BUS PUR COM NAV STA"

< Cache-Control: private,max-age=0,must-revalidate

< Set-Cookie: NSC_vt1.sbmmzefw.dpn!-!IUUQT=ffffffff09091c3845525d5f4f58455e445a4a42378b;path=/;secure;httponly

< 

{ [data not shown]

100   213  100   156  100    57    237     86 --:--:-- --:--:-- --:--:--   237
100   213  100   156  100    57    237     86 --:--:-- --:--:-- --:--:--   237
* Connection #0 to host us1.rallydev.com left intact

我找不到任何关于此服务器错误的官方文档,所以我很难过。另请注意,我使用的apikey具有服务器写入权限。

1 个答案:

答案 0 :(得分:1)

我在发布此消息后不久发现了我的错误。虽然Rally没有返回有关日期格式的错误,但这是问题所在。它将20151405视为有效的ISO8601日期,但不是拉力赛期望的具体形式,即“YYYY-MM-DD”。将行更改为:

updatedDefect.addProperty("c_ProdDeployDate", "2015-14-05");

修复了问题。