It's all about the answers!

Ask a question

How to import ReqIF file in DNG using OSLC API?

Pavithra Shivalingappa (12828) | asked Jun 12 '18, 9:56 a.m.

Unable to import ReqIF file after getting the ReqIF package URL. How to use DNG ReqIF API

Below is the request.


Accept: application/rdf+xml
Oslc-Core-Version: 2.0
Content-Type: application/rdf+xml


<rmReqIF:ReqIFImport rdf:about="">


HTTP RESPONSE: 202. Gives the location url.
If i hit the location url then the status of task is incomplete.

<rm:taskCompletionStatus rdf:datatype="">FATAL_ERROR</rm:taskCompletionStatus>

<rm:taskPhase rdf:datatype="">Completed</rm:taskPhase>
Please comment if anyone knows solution for this above question.

Thanks & Regards
Pavithra S

5 answers

permanent link
Gabriel Ruelas (1.1k13) | answered Jun 13 '18, 10:56 a.m.


Looks like you are using an internal representation ( see the rmReqIF namespace ).

You have to follow the spec described in :

For OSLC ReqIF Import you should specify :
dng_reqif:package Exactly-onetrueResourceReference dng_reqif:ReqIFPackage Specifies a ReqIF Package to be imported.
Hope that helps.

Pavithra Shivalingappa commented Jun 13 '18, 11:09 a.m.

 Is the request URL correct? I have included the ReqIF package to be imported  in the request body already. But still there is an error.

permanent link
Gabriel Ruelas (1.1k13) | answered Jun 13 '18, 11:40 a.m.


No , you should not be using rmReqIF, use dng_reqIf ("") name space and the format in the doc

Pavithra Shivalingappa commented Jun 13 '18, 11:52 a.m. | edited Jun 13 '18, 11:56 a.m.

permanent link
Gabriel Ruelas (1.1k13) | answered Jun 13 '18, 3:43 p.m.


 Try following for version previous to 606:
    <dng_reqif:definition rdf:resource="https://server.ip:port/rm/reqif/descriptors/_VceSYW9BEeiwWMPA5cp7jg"/>

Try following for versions 606 and up.

         <dng_reqif:package rdf:resource="https://server:port/rm/reqif/descriptors/_uW8p0yMMEeimytylMhrqug"/>

Pavithra Shivalingappa commented Jun 14 '18, 3:43 a.m.

 Hi Gabriel,

   Tried in both ways but still getting 201 as http response followed by 302 error code.
My clm version is 6.0.5. 
Request URL: https://server:port/rm/reqif_oslc/import?componentURI=https://server:port/rm/cm/component/_i_U5YD4rEeiS8byYflf27Q
Request Headers: OSLC-Core-Version :2.0, Accept & Content-Type : application/rdf+xml, Configuration-Context : stream url
What might be missing in the request? Could u pls suggest.

Pavithra S

permanent link
Gabriel Ruelas (1.1k13) | answered Jun 14 '18, 9:45 a.m.

 Hi, I just installed a 605 GA and tested my sample program and it works fine. It is using the package definition :

    <dng_reqif:definition rdf:resource="https://server.ip:port/rm/reqif/descriptors/_VceSYW9BEeiwWMPA5cp7jg"/>

This is the method I am using :
private static String importReqIfPackage(String importFactoryUrl, String reqIfpackageUrl, JazzFormAuthClient client) throws ClientProtocolException, IOException, UnsupportedOperationException, InterruptedException {
String returnMessage = "Unexpected error while trying to import the ReqIf package";
HttpPost importRequest = new HttpPost(importFactoryUrl);
importRequest.addHeader("OSLC-Core-Version", "2.0");
importRequest.addHeader("Content-Type", "application/rdf+xml");
// Sample model used
/<?xml version="1.0" encoding="UTF-8"?>
<dng_reqif:package rdf:about="">
<dng_reqif:definition rdf:resource="{definition}"/>
Model model = ModelFactory.createDefaultModel();
model.setNsPrefix("dng_reqif", "");
Resource reqIfImportResource = model.createResource();
reqIfImportResource.addProperty(RDF.type, model.createResource(""+ "package"));
reqIfImportResource.addProperty(model.createProperty("" + "definition"), model.createResource(reqIfpackageUrl));
StringWriter writer = new StringWriter();
model.write(writer, "RDF/XML-ABBREV");
BasicHttpEntity entity = new BasicHttpEntity();
String toSend= writer.toString();
byte [] bytes = toSend.getBytes("UTF-8");
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
HttpResponse postImportResponse = client.getHttpClient().execute(importRequest);
if ( postImportResponse != null ) {
int statusCode = postImportResponse.getStatusLine().getStatusCode();
if ( statusCode == 202 ) {
Header taskHeader = postImportResponse.getFirstHeader("Location");
// Lets wait for the task to complete
if ( taskHeader != null ) {
String taskUrl = taskHeader.getValue();
String resultInfo = waitForTaskTraker(taskUrl, 10, client);
if ( resultInfo != null ) {
returnMessage = "Task ended with code :" + resultInfo;
return returnMessage;

permanent link
Gabriel Ruelas (1.1k13) | answered Jun 14 '18, 9:52 a.m.

 Just add the configuration context header:

importRequest.addHeader("Configuration-Context", "https://server.ip:9443/rm/cm/stream/_nJd8gG_ZEeiFntPvECNjhg");

Just tested on different cfgs and it works fine

Pavithra Shivalingappa commented Jun 18 '18, 10:09 a.m.

Hi Gabriel, 

   Now I'am testing with 6.0.5 server and its working fine. Later, I will test  with different versions .
Thanks for your support Gabriel. 
One more clarification,  in the above importReqIfPackage(....) method, you have called waitForTaskTraker(....) . What it does? It waits for ten milliseconds and then fetches the status?

Pavithra s

Gabriel Ruelas commented Jun 18 '18, 11:24 a.m.

 The pots returns a task tracker URL, it is used by that method to do gets on it until the task is done. 

You can see that behavior when the RDNG UI issues a import CSV.

Best regards

Pavithra Shivalingappa commented Jun 18 '18, 11:41 a.m.

Any website / links to refer to know how to use it ?

Pavithra Shivalingappa commented Aug 11 '18, 9:23 a.m.

Hi Gabriel,
    The task tracker URL shows the state as complete and verdict as passed . But when i check the report , it shows errors and file is not imported successfully. How can i track  this?
Currently we have dcterms:references  to view the report.
Do we have any option to track whether the file was imported successfully or not without checking the report ?


Gabriel Ruelas commented Aug 13 '18, 7:58 a.m.


That is the only way I know.

Best Regards.

Your answer

Register or to post your answer.