java - 尝试使用 Rally Java 工具包更新用户故事时出现 "Could not update: Could not write changes in Unit Of Work"错误

标签 java curl rally

尝试使用此处的 java 工具包更新 Rally 中的用户故事时: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 来做到这一点,但没有成功。

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

测试.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 具有服务器写入权限。

最佳答案

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

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

解决了问题。

关于java - 尝试使用 Rally Java 工具包更新用户故事时出现 "Could not update: Could not write changes in Unit Of Work"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30251449/

相关文章:

csv - 如何通过终端(SSH)下载 CSV?

php - GoDaddy PayPal API 警报握手失败

node.js - 集会 Node sdk返回错误: getaddrinfo ENOTFOUND

java - 从一个网址设置 cookie 并从另一个网址获取,如果路径未设置为 '\' ,为什么它不起作用?

java - 如何使用透视投影矩阵?

php - 使用 PHP cURL 缓存

javascript - 如何在组合框中获取自定义数据

javascript - 如何限制测试用例中的结果

java - 在多个 EditText 上添加值并在每个 textchange 上获取总计

java - eclipse 中的 classdefnotfound 错误(奇怪)