我尝试使用其REST API与IBM Rational Quality Manager服务器进行通信。我使用RESTClient浏览器插件,当浏览器登录时,一切都按预期工作。为了记录,我的请求看起来像
https://server/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testscript/urn:com.ibm.rqm:testscript:42
但是,如果我等待RQM注销的时间足够长,REST API说我需要重新登录才能继续(见下文)。我很确定通过API本身可以做到这一点,因为RQM附带RQMUrlUtility,它接受用户名和密码,并运行基本相同的REST请求我使用:
java -jar RQMUrlUtility.jar -command GET -user JazzUserID -password JazzPassword -filepath pathtoFile -url REST_URL
到目前为止,我发现this topic解释了如何使用HTTP基本身份验证登录。根据这个建议,我在请求中添加了Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
(不是我的真实密码),但RQM仍然无法登录。我还尝试将User-Agent
设置为虚假值,并将JSESSIONID
中的X-Jazz-CSRF-Prevent
值发送到here所述的Status Code: 200 OK
Cache-Control: no-cache="set-cookie, set-cookie2"
Connection: Keep-Alive
Content-Encoding: gzip
Content-Language: en-US
Content-Type: text/html; charset=UTF-8
Date: Tue, 26 Jan 2016 15:48:02 GMT
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Keep-Alive: timeout=10, max=100
Set-Cookie: JazzFormAuth=Form; Path=/qm; Secure
x-com-ibm-team-scenario=ac55f959-c738-4ef0-854d-6e37648edcba%3Bname%3DInitial+Page+Load%3Bextras%3D%2Fqm%2Fauth%2Fauthrequired%2C1453823282026; Path=/
Transfer-Encoding: chunked
X-Powered-By: Servlet/3.0
X-com-ibm-team-repository-web-auth-msg: authrequired
,但不管所有这些标头是否存在不是,我得到同样的答复:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(termsCell, forIndexPath: indexPath) as! TableViewCell
let linkRangeIndex = attributedString.string.rangeOfString("link")
let linkRange = attributedString.string.NSRangeFromRange(linkRangeIndex!)
attributedString.setAttributes(linkAttributes, range: linkRange)
cell.termsLabel.attributedText = attributedString
cell.termsLabel.userInteractionEnabled = true
textContainer.lineFragmentPadding = 0.0
textContainer.lineBreakMode = cell.termsLabel.lineBreakMode
textContainer.maximumNumberOfLines = cell.termsLabel.numberOfLines
let labelSize = cell.termsLabel.bounds.size
textContainer.size = labelSize
let tapGesture = UITapGestureRecognizer(target: self, action: "handleTapOnLabel:")
cell.termsLabel.addGestureRecognizer(tapGesture)
return cell
任何有RQM API经验的人都可以告诉我什么错了吗?或许我错过了一些基本的东西,大多数RESP API都是常见的?
答案 0 :(得分:4)
这可能是你的标题名称吗?
Authorisation: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
应该是:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
注意" z"。