Creating a Work Item in RTC/RQM 4.0 using OSLC REST API Pragmatically in Java
Hi ,
I have tried to explore the OSLC API in java by following the OSLC Workshop 2012-11-26-OSLC-workshop.pdf
Now I want to create a Work Item using my java code to RTC 4.0 or RQM 4.0 but i didn't found the much documentation and example in the same.
I found some links related to this in Jazz.net but those are outdated.
Can anyone guide/help me regarding this issue?
|
7 answers
To create Work Item, you'd have to either use CreationDialog (provides delegated UI from RTC to create WI) or CreationFactory (where you'd do a POST to the CreationFactory URI with whatever content needs to go into your WI) service.
I've not tried the workshop myself, so I don't know if there's any sample in there. To understand how to use CreationDialog or CreationFactory, you can refer to the following article:
Hope that helps.
|
For the OSLC QM V2 API in RQM, see https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api.
Comments
Thanks to Paul & Sudarshan ..!!!
Currently i am trying to create Workitem in RTC 4.0.1, While sending a POST request to the JTS server using Creation Factory URL , i am getting exception : HTTP/1.1 403 Forbidden
The java console also shows the following warnings:
Apr 17, 2013 3:04:53 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "set-cookie: jfs-request-token-921b8e2710b8421491dc2acbd202fa1b="ucmegnBNg42NOrg2lvWgpu3KjUQFnag3m0AsrUUklx8="; Version=1; Max-Age=600; Expires=Wed, 17-Apr-2013 09:44:53 GMT; Path=/cm". Unable to parse expires attribute: Wed
Apr 17, 2013 3:04:53 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm=https:<server name>:9443/jts/oauth-authorize
I have added following in the my post request header
post.addHeader("Accept", "application/xml");
post.addHeader("Content-Type", "application/xml");
post.addHeader("OSLC-Core-Version", "2.0");
I am able to send a GET request successfully to fetch the protected resources like: Creation Factory URI, Resource Shape URI
Can anybody help me regarding this issue?
Your HTTP client is not authenticated with the RTC server. Try logging into RTC from FireFox and using Poster and/or HttpRequester to make the HTTP request.
Don Yang
commented Apr 17 '13, 9:17 p.m.
We have seen 403 error when the below situation applied:
|
There are also some videos on YouTube that you may find useful:
http://www.youtube.com/playlist?list=PL8968B48E8DD75B34 Comments
Rahul Singh Bhadauriya
commented Apr 18 '13, 5:38 a.m.
Hi Kot,
|
Hi Rahul,
it's a good point you've already experienced the OSLC workshop. As you've figured out already, it misses an RQM-related section. For the moment (but there are plans to add such subpart to it). In the meanwhile, you've a starting point (code for auth, etc. ) In addition to the RQM wikis (providing extensive information and already pointed out to you by Paul), you could check sample-based "cheat sheets" / "How Tos" provided in this blog: http://sleroyblog.wordpress.com/2013/04/09/querying-rqm-40-through-oslc-and-rest-api/ Regards, Stéphane Comments
Rahul Singh Bhadauriya
commented Apr 18 '13, 5:38 a.m.
Hi Stéphane,
|
Rahul,
See if this article offers any help: https://issues.apache.org/jira/browse/HTTPCLIENT-896. It looks like the "Expires" value for your cookie is not in a valid format (for whatever reason) and this article provides some steps in the comments to workaround.
Mike Jaworski
|
Hi Eric,
It works fine after adding the header [X-Jazz-CSRF-Prevent] value as current JSESSIONID for me. reference: https://jazz.net/forum/questions/98072/x-jazz-csrf-prevent-header-is-required-to-create-a-work-item-via-oslc-on-version-4001 i.e postRequest.addHeader("X-Jazz-CSRF-Prevent","
AAAACF37530880CEE8034FD5A890453F")
You can also try to make a POST request via REST Client add-on in Firefox.
Comments Hi Rahul,
Jan 20, 2017 4:28:13 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Invalid cookie header: "Set-Cookie: WASReqURL=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly". Invalid 'expires' attribute: Thu, 01 Dec 1994 16:00:00 GMT is it because of session id issue ? if so how can i overcome with this problem?
i used IRawRestClientConnection to perform doPost operation. |
In RDNG(6.0.1 M2 in my cases) when you try to create new requirement no matter how REST client(like POSTMAN) or using Eclipse Lyo if you do not specify tititle of the requirement as well as the instanceShape the result is 403 Forbiden. So you can omit the nav:parent, but title and instanceShape are mandatory.
So my request (working ) is : <rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/terms/"xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/"xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/"xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/"xmlns:acp="http://jazz.net/ns/acp#"xmlns:rm_property="https://grarrc.ibm.com:9443/rm/types/"xmlns:oslc="http://open-services.net/ns/core#"xmlns:nav="http://jazz.net/ns/rm/navigation#"xmlns:oslc_rm="http://open-services.net/ns/rm#" ><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">OSLC Creation Example 2</dc:description><dc:title rdf:parseType="Literal">OSLC Created Requirement 2</dc:title><dc:contributor rdf:resource="https://10.0.2.79:9443/jts/users/Admin"/><oslc:instanceShape rdf:resource="https://10.0.2.79:9443/rm/types/_opYnsUZsEeWL2aNIq4SA-w"/><nav:parent rdf:resource="https://10.0.2.79:9443/rm/folders/_4du-YEDTEeW98vRabXRPEQ"/></rdf:Description></rdf:RDF>with header : Content-Type: application/rdf+xml |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Hi Rahul,