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



在尝试使用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 无法更新:无法在Unit Of Work我试着通过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

用法:

{"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)Gitbincurl-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");

修复问题

相关内容

最新更新