It's all about the answers!

Ask a question

How to use DNG ReqIF API


Pavithra Shivalingappa (128219) | asked May 18 '18, 4:56 a.m.
edited May 22 '18, 4:31 a.m.

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.

2 answers



permanent link
Gabriel Ruelas (1.1k13) | answered May 28 '18, 9:23 a.m.

 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;
}


Comments
Pavithra Shivalingappa commented May 28 '18, 11:43 a.m.

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?



Gabriel Ruelas commented May 28 '18, 1:04 p.m.

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


Pavithra Shivalingappa commented May 29 '18, 3:11 a.m.

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




Gabriel Ruelas commented May 29 '18, 8:53 a.m.

AFAIK no,  for public API you should use:

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


Gabriel Ruelas commented May 29 '18, 8:53 a.m.

 AFAIK no,  for public API you should use:

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


Pavithra Shivalingappa commented May 29 '18, 11:13 a.m.

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>




Pavithra Shivalingappa commented May 30 '18, 5:41 a.m.

Please do reply on the above comments.


Pavithra Shivalingappa commented Jun 04 '18, 9:24 a.m.

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



Gabriel Ruelas commented Jun 04 '18, 4:14 p.m.

Hi,

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


Pavithra Shivalingappa commented Jun 07 '18, 5:14 a.m.

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.








 


Gabriel Ruelas commented Jun 07 '18, 8:33 a.m.

 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


Pavithra Shivalingappa commented Jun 07 '18, 9:31 a.m.

Could you please send the link for checking docs.

Is the request URL correct?


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

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


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

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

Best Regards


Pavithra Shivalingappa commented Jun 12 '18, 3:51 a.m.

Unable  to see the latest comments.

showing 5 of 15 show 10 more comments

permanent link
Piku piku (111) | answered Aug 22 '19, 3:51 p.m.
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?




Comments
Rosa Naranjo commented Aug 22 '19, 4:16 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

please start a new post for this question.

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.