Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

OSLC access to ressources, how to ?

Hello everyone,

I am trying to consume OSLC-RM v2.0 in DOORS 9.4 + DWA 1.5.
Is there a generic way to access a list of ressources ? How does it work usually ?
Because I am able to get a single requirement as an xml file but I don't know how to get all of them in one xml or a list of them matching some conditions (OSLC query service).

What is the usual way to access requirements stored in DOORS database with OSLC ?
Thanks a lot for your help

0 votes



6 answers

Permanent link
 Dear Rahul and Sudeshna,

This OSLC-RM is protected by the OAuth authorization protocol. You have to implement an OAuth client and create an OAuth consumer profile in DOORS to get your API authorized BEFORE you send any REST request, otherwise you will get the unauthorized error. I am not familiar with Java based libraries but i know it is easy to find and use one. Building an OAuth client and understanding the protocol should not take more than half a day to a day. Creating an OAuth provider is another story...
Note that DOORS 9.4 + DWA 1.5 use OAuth 1.0a so this is the logic your OAuth client should adopt. 

See this flow chart : 

See libraries and examples :

See the specification 1.0a in our case :

See the getting started article :



As for the hierarchy, it is very clear, I even managed to display a tree representation of the database, just pulling data from the OSLC-RM implementation.

Here are a few hints :

once authenticated via OAuth, GET http://localhost:8080/dwa/rm/discovery/catalog.
the xml should display this type of node : 

oslc:serviceProviderCatalog rdf:resource="http://localhost:8080/dwa/rm/discovery/catalog/urn:rational:DATABASEID:1-4fe8345454562e6e-F-00454545"

AND / OR this :

oslc:serviceProvider rdf:resource="http://localhost:8080/dwa/rm/discovery/service/urn:rational:ers-4fe8454545a62e6e:1-4fe839f150a62e6e-M-00454545"

You are here at the root of the database. Make sure you have enough data to play with in your database to have a nice visible structure. So here it means there will be one node like this for each module, project or folder available to you at the root of the database. For each module available there will be a serviceProvider node like above and for each folder/project available there will be a serviceProviderCatalog node available like above.

If you GET the URL in the xml rdf:resource attribute of a serviceProviderCatalog node, you will get another serviceProviderCatalog xml containing the same types of nodes but this time this is the catalog of a new resource, which is identified by the URN contained in the URL you just made a GET on.

If you GET the URL in the xml rdf:resource attribute of a serviceProvider, you will end up with an serviceProvider XML containing the actual endpoints of all the services related to the module you are looking at, which is identified by the URN contained in the URL you just made a GET on.


With all these hints, look at the URLs provided, you will see the URNs of resources available in your usual DOORS client. The OSLC resources follow precisely the hierarchy of your database, given that the modules correspond to an OSLC-RM service provider and folders or projects correspond to OSLC-RM service provider catalogs (in DOORS implementation only of course, this is up to the tool vendor more or less).


Other useful tips : 

- In a URN if you see "-F-" in it, it means you are looking at the URN of a Folder OR Project. From the OSLC point of view no need to make the difference between folders and projects because both can contain modules, folders and projects. 
- In a URN if you see "-M-" in it, it means you are looking at the URN of a Module.
- Only Modules can contain Requirements, and they can only contain Requirements.
- In a URN if you see "-O-" in it, it means you are looking at the URN of a Requirement.
- A DOORS module corresponds to an OSLC service provider. 
- DOORS folders and projects are seen as catalogs only, because they do not provide services and catalogs can list other catalogs.


Useful URLs if you still have trouble navigating (but from an OSLC point of view this should not be hard-coded) :

http://localhost:8080/dwa/rm/discovery/catalog 1
http://localhost:8080/dwa/rm/discovery/catalog/+PROJECT-URN 2
http://localhost:8080/dwa/rm/discovery/catalog/+FOLDER-URN 2b
http://localhost:8080/dwa/rm/discovery/service/+MODULE-URN 3
http://localhost:8080/dwa/rm/oslc/query/+MODULE-URN+oslc-query 4
http://localhost:8080/dwa/rm/+REQUIREMENT-URN 5
http://localhost:8080/dwa/rm/oslc/shape/requirement/+CORRESPONDING-MODULE-URN 6

1- ROOT catalog of root service providers. discover the URN of the projects or folders. Both may present service providers in a catalog.
2-2b get the catalog of service providers within the project or folder selected by its urn
3- discover the services of a module selected by its urn
4- formulate a requirement query to the selected module
5- direct link to the XML representation of a Requirement selected by its URN
6- access to the requirement ressource shape of a module in order to get all the definitions like custom attributes and base attributes.


I hope this helps,
Louis Madeuf

PS : please thumbs up my answers you find useful

2 votes

Comments

Hi Louis,

Thanks for your mail.I have done the hierarchy based on the URN , using which i am able to find the FOLDERS, PROJECT , MODULE ....

What i am also looking for is the hierarchy within Object and its child elements, for example:

Lets assume, i have a module which has the following objects :

  1. My Requirement 1.1 My Sub-Requirement 1.2 My Other Sub-Requirement

  2. My Other requirement

In the above case, i am not getting the Objects within the module in proper hierarchy through OSLC.

Please let know on this.

Regds Rahul Chandrashekar,

Good question. I did not need such a hierarchy in my project but from what I understand the classic DOORS client deduces this hierarchy only by reading/creating the system attribute called "object number". For example if you create a requirement numbered "1" in a module, right-click on it an then click "object below", it will create a requirement numbered "1.1". I think reading this attribute is the only way to store/retrieve this hierarchy so your OSLC-RM client should read this attribute in each requirement it fetches so you know where to put it in your data model.

I don't really see another solution, I would go for this first. Let us know if you do this and if it works, I think it should.

Best regards, Louis M

Hi,

The above hierarchy was already done. I was more interested on the hierarchy for the Objects, and i was looking into different blogs for the same...

Kindly let know if you have any other work around solutions :-)

Regds Rahul Chandrashekar,

Hi

One more point, when i get the requirement objects, i dont get the i.d

like : 1 .. 1.1..

Regds Rahul

1 vote

Good point, I don't remember seeing them in the xml. I'll have a look tomorrow to see if I find another idea.

1 vote

Thanks Louis, it will be so helpful of you if you help me out.

Apart from this i had found one more thing

I also came to know that there is an another work-around for the same using Delegate UI search, in which we can get the Modules / Requirements in Hierarchy, Please refer to the below URL.

http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Delegated_User_Interface_Dialogs

On executing the URL with Post message protocol, we are able to get the requested requirements and when we select the requirement it give us a table which contains the id and the requirement label, in this page there are 2 button options are available (Ok and Cancel

When we select Ok, it seems OSLC should respond with a message . but we are not able to get this message on our application. We are currently use SWT BROWSER widget to load the above

kindly let us know how can we proceed on the same.

Rahul, Sadly it seems like you have reached the border of my knowledge. i am working in C# therefore I cannot help you with this Java widget. I am waiting for some information regarding the hierarchy, I will post it here if i get it. Are you sure the hierarchy you get in your workaround is the one you are looking for and not just the number given at the beginning of the attribute "short title" ? Because if your workaround uses OSLC resources I don't understand how this is possible since the hierarchy order is not in the xml resource.

Dear Louis,

For time being lets seperate the technology we are working.

When i do an OSLC query i get the requirements with id

for example:

  1. My Requirement

  2. My Sub-Requirement

  3. My Other requirement..

But in Hierarchy the same is defined like this:

1 My Requirement

1.1 My Sub-Requirement

  1. My Other requirement

And i was interested in the second tree structure, but i am ending up in the first tree structure. Even i tried to have an exhaustive look into the xml-rdf file but i am not able to find any relationship on the same. Maybe there should some attribute tag in the xml file which probably links to the requirements to get the hierarchy.

Best Regds Rahul Chandrashekar.

The other day I was wondering if this logic was not inside the number at the end of each URN... I did not look into it further but try maybe to see if th URNs reflect this tree hierarchy

Dear Rahul, I have got news directly form IBM. They said it is not possible to track this information yet. You will need to find your own workaround for this. Sorry for the bad news !

Hi,

Eureka......we are now able to get the Hierarchy information using the Delegated UI Search mechanism. This works. But i have a problem i have to refresh or provide my authentication details everytime i do some operation.

Is there any way how i maintain a session, so that i need not have to keep on providing the user and password details.

Regds Rahul.

showing 5 of 11 show 6 more comments

Permanent link
Hello everybody, I found a solution to my problem so I am posting here my solution so that it might help others.

Here are a few checkpoints :
- Be sure you have set your accept header to "application/rdf+xml"
- Be sure you have the right query base URL
- Be sure you have specified the right URL to your attributes called in your oslc query

here is a working example of a query to get all the requirements out of a particular module :

http://localhost:8080/dwa/rm/oslc/query/URN_OF_THE_MODULE?oslc.prefix=dcterms=<"http://purl.org/dc/terms/">&oslc.where=dcterms:created<= TODAYS DATE IN YYYY-MM-DD FORMAT

This query for this type of data (requirement) will only work for DOORS 9.4 + DWA 1.5

I hope it helped some of you !

ps : remove the quotes around the purl.org url, I put them here because the forum did not display the url correctly. This url is where the dcterms are defined (dublin core)

0 votes


Permanent link
 Hi Swapna,

Are you using DOORS 9.4 ? Because OSLC-RM is not implemented in older versions of DOORS.
If you are, make sure you add the correct header to ask the server to respond in the right data format.
You need to set a "application/rdf+xml" header in your REST request parameters, otherwise the server will answer you with html by default, asking you to choose between DWA or DOORS.
To me it sounds like this is what is happening.

I hope this helps,
don't hesitate to ask more questions

Best regards,
Louis

0 votes


Permanent link
 Hello Swapna, 

Sorry for the delay.

1) The header you need to set is the accept header and not the content type header, as stated in the core specification here : http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Service_Provider_Resources

2) You are not using OAuth properly. OAuth is working on a very precise workflow. DOORS 9.4 uses the OAuth 1.0a. Please read more about it here : http://oauth.net/
You need to understand the purpose of OAuth before consuming it : OAuth is NOT a normal authentication protocol. Its purpose is to help a third party (your application) getting a limited access to protected resources (DOORS database), this so called access being granted by the owner of the data (DOORS database user). By doing this, your application never knows your credentials to access the database. This is exaclty what happens when you use facebook to connect to another website. Read a very good article about OAuth here : 

http://hueniverse.com/oauth/

The login page you get is the page where the user says to the database "ok I grant access to my data to the user who requested it, here is my identity." You need to go through this step which is part of the OAuth workflow.

I hope this helps,
Best regards,
Louis

0 votes


Permanent link
Glad it helped !
Well, I don't think it is a good idea since it is not supposed to work like this, it might cause security problems. As I said, OAuth is not an authentication protocol. You are trying to use it like if it was http basic Auth. The OSLC specification allows the implementation of OAuth, Basic Auth, or both. Because you might need to authenticate yourself to access your data but also grant access to an application that needs your protected data. I really encurage you to read the article about OAuth, it helps a lot to understand it and to find ideas about how to handle any bump on the "OAuth road".

I don't know if what you are trying to achieve is possible, but it should not be because of the protocol. There are many people out there trying to do this because they are not using OAuth properly. I am not sure but I think DWA 1.5 supports Basic http Auth as well, so maybe you should look into it because it will work the way you are trying to make it work right now.

If you still wish to use OAuth, here is how I managed to do it in .NET :
I use an embedded web browser in my winform which disappears when it redirects, so just after the user has logged in (because it redirects you to your callback url if access is granted).

0 votes

Comments

I see two major and obvious security problems : - Your application will know your credentials to connect to the database. OAuth is used to prevent your custom application to know them and should only be registered as an OAuth consumer in DOORS. If your application falls into the wrong hands, anybody can access your database. It means you went from a protocol who helps you secure your credentials to badly using the protocol and almost giving away your credentials. Any tool vendor should refuse an application which is not using OAuth properly. - Another security problem is that your credentials will not be encrypted when you are passing them like this to the server by a REST POST.

If you still want/manage to do this, at least use an SSL connection with port number 8443. The SSL connection can be forced in the festival.xml file.

Hi Louis,

Thanks for your feedback. We are now able to connect to DOORS via OSLC, but we have an issue, the modules are not coming based on an hierarchy.

Kindly let us know for any queries which will help on the same

Regds Rahul Chandrashekar

hi, I was trying to get catalog using this link :http://doorswebserver:8080/dwa/rm/discovery/catalog but, the unauthorized error occurred in rest client , can anyone help me how to access catalog using oauth....any oslc java code sample?

Dear Rahul and Sudeshna, please see my answer below.


Permanent link
 As a general tip, be sure to checkout the DOORS and OSLC videos on our YouTube education channel: http://www.youtube.com/IBMRationalUE

Especially these two:



And feel free to search for things such as OAuth within the YouTube channel, we have some very granular tagging of the vids and many more videos around integration.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 516
× 198
× 27

Question asked: Jun 29 '12, 11:27 a.m.

Question was seen: 11,361 times

Last updated: Jun 20 '13, 9:47 p.m.

Confirmation Cancel Confirm