It's all about the answers!

Ask a question

How to add external link to DOORS requirement via OSLC using HTTP PUT


Itai Shimron (16121) | asked May 17 '13, 12:26 p.m.
JAZZ DEVELOPER
Hi All,
I've got the following question on how to add external link to existing doors requirement using OSLC:

According to the OSLC specification, I can do a PUT request on this same URL, adding a header “If-Match” with the value from the ETag header, and in the body of the request put the modified XML representation of the DOORS requirement (I added a dcterms:reference that points to google.com):
<?xml version="1.0"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rm_property="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/"
xmlns:rm="http://jazz.net/ns/rm#"
xmlns:acp="http://jazz.net/ns/acp#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:doorsInternalLinks1="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000026/linkTypes/"
xmlns:oslc_rm="http://open-services.net/ns/rm#">
<oslc_rm:Requirement rdf:about="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-O-21-00000025">
<doorsInternalLinks1:references rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-O-18-00000025"/>
<oslc:instanceShape rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/oslc/shape/requirement/urn:rational::1-50d3587940151bf2-M-00000025"/>
<rm_property:attrDef-9 rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
>21</rm_property:attrDef-9>
<dcterms:description rdf:parseType="Literal">send-receive i/f</dcterms:description>
<oslc:serviceProvider rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/discovery/service/urn:rational::1-50d3587940151bf2-M-00000025"/>
<dcterms:contributor>
<foaf:Person>
<foaf:name>sdmbuild</foaf:name>
</foaf:Person>
</dcterms:contributor>
<rm_property:attrDef-12 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>All control interfaces must use send-receive protocol</rm_property:attrDef-12>
<rm_property:attrDef-0 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
></rm_property:attrDef-0>
<rm_property:attrDef-4 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>bchown</rm_property:attrDef-4>
<dcterms:title rdf:parseType="Literal">21: All control interfaces must use send-receive protocol</dcterms:title>
<dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>21</dcterms:identifier>
<rm_property:attrDef-7 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2013-04-18</rm_property:attrDef-7>
<rm:primaryText rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Standard send-receive for all control data interfaces</rm:primaryText>
<acp:accessControl rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/acp/urn:rational::1-50d3587940151bf2-F-00000000/MkEKX%252BxTtVyE1DPpEXgEzQ5Vv2g%253D%250A"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2013-04-18T20:46:13Z</dcterms:modified>
<dcterms:references rdf:resource="http://sdm-staging.wv.mentorg.com/report/where-Used-Instantiated-Attribute-With-Gui?url=http%3A%2F%2Fsdm02.wv.mentorg.com%3A8080%2Fdwa%2Frm%2Furn%3Arational%3A%3A1-50d3587940151bf2-O-21-00000025"/>
<dcterms:references rdf:resource="http://www.google.com"/>
<rm_property:attrDef-6 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>sdmbuild</rm_property:attrDef-6>
<rm_property:attrDef-13 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>send-receive i/f</rm_property:attrDef-13>
<rm_property:attrDef-10 rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/attrDef-10#1"/>
<rm_property:attrDef-1006 rdf:resource="https://sdm02.wv.mentorg.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/attrDef-1006#3"/>
<rm_property:attrDef-8 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2013-04-18T20:46:13Z</rm_property:attrDef-8>
<oslc:shortTitle rdf:parseType="Literal">21: All control interfaces must use send-receiv...</oslc:shortTitle>
<rm_property:attrDef-5 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2013-01-14</rm_property:attrDef-5>
<dcterms:creator>
<foaf:Person>
<foaf:name>bchown</foaf:name>
</foaf:Person>
</dcterms:creator>
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"
>2013-01-14</dcterms:created>
</oslc_rm:Requirement>
</rdf:RDF>

However, when I run this command from the RESTClient in Firefox, I get an error 401: HTTP Status 401 - Invalid signature for signature method HMAC-SHA1.

If I try this from a Java program instead, using the “signpost” library to assist with signing the OAuth request, I get an error 500 – Internal Server Error.

Here is the part of the OSLC specification that talks about updating resources using a PUT request:
http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Resource_Operations

Here is the page in the DOORS specifications that says it supports this OSLC/REST HTTP PUT request (this applies to DOORS 9.3 and later – I am using 9.4.0.1):
http://pic.dhe.ibm.com/infocenter/doorshlp/v9/index.jsp?topic=%2Fcom.ibm.doors.install.doc%2Ftopics%2Fr_oslc_services.html

Lastly, here is a Jazz.net support page where this HTTP error 401 is discussed, but they never describe in detail how they solved the problem:
https://jazz.net/forum/questions/94750/oauth-access-programatically-to-doorsdwa

Do you have any ideas of what might be wrong here, or who I might be able to talk with to get this resolved? Perhaps this is something we can look at in our meeting this morning?

One answer



permanent link
Itai Shimron (16121) | answered May 17 '13, 12:40 p.m.
JAZZ DEVELOPER
Here is the answer. First as Jena and then as rdf/xml
Thanks to Clyde Icuspit who provided the answer.

To add an external reference to a requirement you need to add a reified statement so that a dc:title could be associated with the new link. The dc:title shows up as the name of the link displayed in the GUI. The code snippet below uses Jena to handle the rdf+xml to create the reified statement expressing the external link and adding it into the rdf model

// theNewValue is the http://www.google.com
Resource aNewResource = m.createResource(theNewValue);

// m is the rdf model
// aResource is the requirement resource


Property refProp = m.createProperty"(http://purl.org/dc/terms/references") ;
Property titleProp = m.createProperty("http://purl.org/dc/terms/title");



Statement link = m.createStatement(aResource, refProp, aNewResource);

ReifiedStatement reBackLinkStatement = m.createReifiedStatement(link);
reBackLinkStatement.addProperty(titleProp, "J2");

m.add(reBackLinkStatement);

--------------------------------------------------------------------------------------
Answer in rdf/xml format:

<rdf:RDF

    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";

    xmlns:acp="http://jazz.net/ns/acp#";

    xmlns:oslc_rm="http://open-services.net/ns/rm#";

    xmlns:oslc="http://open-services.net/ns/core#";

    xmlns:rm_property="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/";

    xmlns:foaf="http://xmlns.com/foaf/0.1/";

    xmlns:dcterms="http://purl.org/dc/terms/";

    xmlns:doorsInternalLinks1="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000026/linkTypes/";

    xmlns:rm="http://jazz.net/ns/rm#"; >

  <rdf:Description rdf:about="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-O-21-00000025">;

    <oslc:instanceShape rdf:resource="https://mydomain.com:8443/dwa/rm/oslc/shape/requirement/urn:rational::1-50d3587940151bf2-M-00000025"/>;

    <oslc:serviceProvider rdf:resource="https://mydomain.com:8443/dwa/rm/discovery/service/urn:rational::1-50d3587940151bf2-M-00000025"/>;

    <doorsInternalLinks1:references rdf:resource="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-O-18-00000025"/>;

    <rm_property:attrDef-9 rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">21</rm_property:attrDef-9>;

    <dcterms:description rdf:parseType="Literal">send-receive i/f</dcterms:description>

    <rm_property:attrDef-12 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">All control interfaces must use send-receive protocol</rm_property:attrDef-12>

    <rm_property:attrDef-0 rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></rm_property:attrDef-0>;

    <rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/>;

    <rm_property:attrDef-4 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">bchown</rm_property:attrDef-4>;

    <dcterms:title rdf:parseType="Literal">21: All control interfaces must use send-receive protocol</dcterms:title>

    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">21</dcterms:identifier>;

    <dcterms:creator rdf:nodeID="A0"/>

    <rm_property:attrDef-7 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-04-18</rm_property:attrDef-7>;

    <dcterms:references rdf:resource="http://www.google.com"/>;

    <rm:primaryText rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Standard send-receive for all control data interfaces</rm:primaryText>

    <acp:accessControl rdf:resource="https://mydomain.com:8443/dwa/rm/acp/urn:rational::1-50d3587940151bf2-F-00000000/MkEKX%252BxTtVyE1DPpEXgEzQ5Vv2g%253D%250A"/>;

    <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-04-18T20:46:13Z</dcterms:modified>;

    <rm_property:attrDef-13 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">send-receive i/f</rm_property:attrDef-13>

    <rm_property:attrDef-6 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">sdmbuild</rm_property:attrDef-6>;

    <dcterms:references rdf:resource="http://sdm-staging.wv.mentorg.com/report/where-Used-Instantiated-Attribute-With-Gui?url=http%3A%2F%2Fmydomain.com%3A8080%2Fdwa%2Frm%2Furn%3Arational%3A%3A1-50d3587940151bf2-O-21-00000025"/>;

    <rm_property:attrDef-10 rdf:resource="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/attrDef-10#1"/>;

    <rm_property:attrDef-8 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-04-18T20:46:13Z</rm_property:attrDef-8>;

    <rm_property:attrDef-1006 rdf:resource="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-M-00000025/types/attrDef-1006#3"/>;

    <oslc:shortTitle rdf:parseType="Literal">21: All control interfaces must use send-receiv...</oslc:shortTitle>

    <rm_property:attrDef-5 rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-01-14</rm_property:attrDef-5>;

    <dcterms:contributor rdf:nodeID="A1"/>

    <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2013-01-14</dcterms:created>;

  </rdf:Description>

  <rdf:Description rdf:nodeID="A0">

    <foaf:name>bchown</foaf:name>

    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>;

  </rdf:Description>

  <rdf:Description rdf:nodeID="A1">

    <foaf:name>sdmbuild</foaf:name>

    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>;

  </rdf:Description>

  <rdf:Description rdf:nodeID="A2">

    <dcterms:title>J2</dcterms:title>

    <rdf:object rdf:resource="http://www.google.com"/>;

    <rdf:predicate rdf:resource="http://purl.org/dc/terms/references"/>;

    <rdf:subject rdf:resource="https://mydomain.com:8443/dwa/rm/urn:rational::1-50d3587940151bf2-O-21-00000025"/>;

    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/>;

  </rdf:Description>

</rdf:RDF>


Your answer


Register or 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.