It's all about the answers!

Ask a question

How to fetch the RTC project area linked to a RQM project area in a LPA using OSLC?


Achla Sharma (3916) | asked May 20 '15, 8:24 a.m.
edited May 20 '15, 8:25 a.m.
We are building a utility that creates a test case in RQM programatically and links it to a workitem(representing requirement) in RTC. For this, we are required to fetch the information of the associated RTC project area.On performing a GET on the catalog URI, I am recieving the following xml response:

<oslc:ServiceProvider ns12:type="oslc:ServiceProvider" rdf:about="https://server.abc.com/qm/oslc_qm/contexts/_HeAYUELvEeSdX50KeLkJBA/services.xml">
                <dcterms:title>RQM_23092014</dcterms:title>
                <dcterms:description></dcterms:description>
                <oslc:details rdf:resource="https://server.abc.com/qm/process/project-areas/_HeAYUELvEeSdX50KeLkJBA"/>
                <jproc:consumerRegistry rdf:resource="https://server.abc.com/qm/process/project-areas/_HeAYUELvEeSdX50KeLkJBA/links"/>
            </oslc:ServiceProvider>

The jproc:consumerRegistry tag specifies the links URL for all the associated project areas.

On performing a GET to the URL, following is the response received:
    <jp:link jp:projectArea="https://server.abc.com/qm/process/project-areas/_HZEGz0JTEeSdX50KeLkJBA">
        <jp:url>https://server.abc.com/qm/process/project-areas/_HZEGz0JTEeSdX50KeLkJBA/links/_dIU3AELsEeSdX50KeLkJBA</jp:url>
        <jp:link-type>tracked-by</jp:link-type>
        <oslc:ServiceProvider xmlns:oslc="http://open-services.net/xmlns/discovery/1.0/">
            <dc:title xmlns:dc="http://purl.org/dc/terms/">Child_60</dc:title>
            <oslc:details xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="https://server.abc.com:443/ccm/process/project-areas/_xK7bkAWUEeSE_JWxIvh7Iw"/>
            <oslc:services xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="server.abc.com/ccm/oslc/contexts/_xK7bkAWUEeSE_JWxIvh7Iw/workitems/services.xml"/>
            <jp:consumerRegistry xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="https://server.abc.com:443/ccm/process/project-areas/_xK7bkAWUEeSE_JWxIvh7Iw/links"/>
        </oslc:ServiceProvider>
    </jp:link>

I am using the xpath ://jp:link[jp:link-type="tracked-by"]/oslc:ServiceProvider/oslc:services/@rdf:resource to fetch the services.xml for the linked project area. I am receiving a null value for it.

Is this the proper way for fetching associations? Some help would be appreciated

One answer



permanent link
Jim Amsden (19336) | answered May 21 '15, 2:04 p.m.
Although it is possible to use HTTP directly and use XPath to parse RDF/XML to find the information you need, that would not be the recommended approach. The reason is that your implementation can be difficult to develop, and sensitive to a particular variant of RDF/XML (of which there are many valid variants).

Instead you may want to explore more abstract APIs such as Eclipse Lyo that hides all these details and does the HTTP protocol negotiations and request and response processing for you. There's a tutorial on Integrating Products with OSLC on open-services.net that you may find very helpful. This tutorial walks through the OSLC discovery capabilities and provides a good explanation for how to navigate the discovery documents and services to get the information you need.

Your answer


Register or to post your answer.