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

How to use DNG ReqIF API

My use case is that i need to import the reqifz file into the project area. I have referred this link https://jazz.net/wiki/bin/view/Main/DNGReqIF  and created the request uri as per the document.
But getting some errors.

Has any one tried it out or any idea on it. Any help is welcomed.

I tried the below request:

Request headers:

1) Accept: application/rdf+xml
2) Content-type : application/rdf+xml
3) vvc.configuration of stream
4) DoorsRP-Request-Type : public 2.0
5) userMimeType: application/zip
6) filename of the reqifz file.

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:types="http://www.ibm.com/xmlns/rdm/types/" xmlns:dng_reqif="http://jazz.net/ns/rm/dng/reqif#ReqIFImport">
  <dng_reqif>
  <types:package>
    <types:content rdf:resource="test.reqifz"/>  
</types:package>
  </dng_reqif>
</rdf:RDF>

Request URI:

   https://localhost:9443/rm/reqif_oslc/import?componentURI=https://localhost:9443/rm/rm-projects/_y45KZTvLEeigONvxHDayiw/components/phgghvn
  
Response:
  dng_reqif:definition resource was not found in RDF.

0 votes



2 answers

Permanent link

 Hi ,

I have successfully used following code. You only need to add the Config-Context with the desired configuration.

private static String uploadReqIfFile (String packageFactoryUrl, String fileName , JazzFormAuthClient client ) throws ClientProtocolException, IOException {
String reqIfPackageUrl = null;
HttpPost uploadFile = new HttpPost(packageFactoryUrl);
uploadFile.addHeader("OSLC-Core-Version", "2.0");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody("userMimeType", "application/zip", ContentType.TEXT_PLAIN);
// This attaches the file to the POST:
File f = new File(fileName);
builder.addBinaryBody(
    "file",
    new FileInputStream(f),
    ContentType.create("application/zip"),
    f.getName()
);
HttpEntity multipart = builder.build();
uploadFile.setEntity(multipart);
HttpResponse queryHttpResponse = client.getHttpClient().execute(uploadFile);
if ( queryHttpResponse != null ) {
int statusCode = queryHttpResponse.getStatusLine().getStatusCode();
if ( statusCode == 201 ) {
Header locationHeader = queryHttpResponse.getFirstHeader("Location");
if (locationHeader != null ) {
String locationUrl = locationHeader.getValue();
//We have a location, now lets import it
if ( locationUrl != null ) {
reqIfPackageUrl = locationUrl;
}
}
}
}
return reqIfPackageUrl;
}

0 votes

Comments

Hi ,

      Thanks for the reply. But few parameter values are unknown. Could you please clarify.

   What should be the value to the parameter packageFactoryUrl ?
Where should we mention the module url where the import should happen?


The packageFactoryUrl can be discovered from the project Services document. This API is just to upload the reqif file.


Use the import one to get the data from the ReqIF File

Is the request body what i have posted here is correct? 

Request headers:

1) Accept: application/rdf+xml
2) Content-type : application/rdf+xml
3) vvc.configuration of stream
4) DoorsRP-Request-Type : public 2.0
5) userMimeType: application/zip
6) filename of the reqifz file.

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:types="http://www.ibm.com/xmlns/rdm/types/" xmlns:dng_reqif="http://jazz.net/ns/rm/dng/reqif#ReqIFImport">
  <dng_reqif:ReqIFImport>
  <dng_reqif:package>
    <types:content rdf:resource="test.reqifz"/> 
</dng_reqif:package>
  </dng_reqif:ReqIFImport>
</rdf:RDF>

Request URI:
   https://localhost:9443/rm/reqif_oslc/import?componentURI=https://localhost:9443/rm/rm-projects/_y45KZTvLEeigONvxHDayiw/components/phgghvn



AFAIK no,  for public API you should use:

Configuration-Context  instead of vvc.configuration
OSLC-Core-Version instead of DoorsRP-Request-Type

 AFAIK no,  for public API you should use:

Configuration-Context  instead of vvc.configuration
OSLC-Core-Version instead of DoorsRP-Request-Type

Hi,
   When i run the method which you have posted , the output is http status code 302 is thrown.
For the parameter packageFactoryURL i have taken the parameter value from the <oslc:creation> tag in services.xml.

<oslc:CreationFactory>
        <oslc_config:component rdf:resource="https://localhost:9443/rm/cm/component/_OGxSYDjWEeigONvxHDayiw" />
        <oslc:resourceType rdf:resource="http://jazz.net/ns/rm/dng/reqif#ReqIFPackage" />
        <oslc:creation rdf:resource="https://localhost:9443/rm/reqif_oslc/import?componentURI=https://localhost:9443/rm/cm/component/_OGxSYDjWEeigONvxHDayiw" />
        <dcterms:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ReqIF Package Factory</dcterms:title>
    </oslc:CreationFactory>



Please do reply on the above comments.

Hi Gabriel,

   I have the run the method which has been posted by you. But its not working. Response is 404 error code. Please let me know how to solve this.

Regards,
Pavithra S


Hi,

Sorry but with current inf, I am not sure what could be the error. It could be an issue with your RDNG version?

Hi Gabriel,
    Now I'm able to fetch the package url / locationURL.   Now this we need to give it as request body input to the import request url?
And what all request headers ,request url and request body to be used?
Currently,
REQUEST URL: 
https://localhost:9443/rm/reqif_oslc/import?componentURI=https://localhost:9443/rm/rm-projects/_65sYYGPpEeis_bpxP5OClg/components/_7VEs0GPpEeis_bpxP5OClg

REQUEST HEADERS:
OSLC-Core-Version: 2.0
Accept : application/rdf+xml
vvc.configuration : stream url

And location url is : https://localhost:9443/rm/reqif/descriptors/_tZtviGovEeis_bpxP5OClg

Thanks in advance.








 

 Hi,

Instead of "vvc.configuration" use "Configuration-Context"  to specify the configuration uri.  Also provide the required rdf body ( check docs ) for the Post.

Best Regards

Could you please send the link for checking docs.

Is the request URL correct?

Hello Gabriel,
  We are getting "FATAL ERROR" as taskcompletionstatus with the below request for importing. Please let me know what's missing in the below request after fetching the package url.
Request URL:  https://localhost:9443/rm/reqif/import?componentURI=https://localhost/rm/rm-projects/_yjdR4DjWEeigONvxHDayiw/components/_0ap4AGryEeiVzuQmixXetA
Request Body:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rmReqIF="http://www.ibm.com/xmlns/rdm/reqif/">
<rmReqIF:ReqIFImport rdf:about="http://jazz.net/ns/rm/dng/reqif#ReqIFImport">
<rmReqIF:importToProject rdf:resource="https://localhost:9443/rm/rm-projects/_yjdR4DjWEeigONvxHDayiw/components/_0ap4AGryEeiVzuQmixXetA"></rmReqIF:importToProject>
<rmReqIF:reqifPackageURI rdf:resource="https://si-z0rl9.si.de.bosch.com:9443/rm/reqif/_gNbWQm1OEeiVzuQmixXetA"></rmReqIF:reqifPackageURI>
</rmReqIF:ReqIFImport>
</rdf:RDF>
Response is 202 with the location url.
TaskCompletionStatus is FATAL_ERROR

In Addition to the above request,
Request Headers:
Configuration-Context: STREAM URL
content-type AND accept: application/rdf+xml

Best Regards

Unable  to see the latest comments.

showing 5 of 15 show 10 more comments

Permanent link
Hi Pavitrha,
Were you able to use doors API to read data from doors? I need to read and write doors requirements data, can you help me?



0 votes

Comments

please start a new post for this question.

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
× 10,938

Question asked: May 18 '18, 4:56 a.m.

Question was seen: 4,297 times

Last updated: Aug 22 '19, 4:16 p.m.

Confirmation Cancel Confirm