OSLC DXL services example [message #1704871] |
Mon, 10 August 2015 05:08  |
Eclipse User |
|
|
|
Hi,
I note OSLC has some limitations to get certain information from DOORS 9.5. For instance, a ServiceProviderCatalog (SPC) could be the DOORS DB, a Project or a folder. However, using OSCL, I cannot know what type of DOORS element is a SPC.
Therefore, I think to use OSLC DXL services to request to DOORS the information I cannot get from pure OSLC.
I found an example on IBM Knowledge Center, but the shown example uses pure REST commands.
Has someone worked on OSLC DXL using OSLC4J? Do you have some example to show how it works?
Thanks for your help.
Carlos
[Updated on: Mon, 10 August 2015 05:33] by Moderator
|
|
|
|
Re: OSLC DXL services example [message #1713082 is a reply to message #1705125] |
Fri, 30 October 2015 12:24   |
Eclipse User |
|
|
|
Hi Romain,
Thanks for your answer. Sorry for my delay... I'm taking the topic again.
So, I'm using OSLC4J to exchange information with DOORS 9.5 using the OSLC interface.
I want to use OSLC4J to request OSLC-DXL services because the authentication process was already done and I don't want to re-code the work already made in OSLC4J.
Therefore, I register the DXL script on the DOORS server as it is mentioned in the IBM Knowledge Center. Now, I want to use the OSLCClient to access to the OSLC-DXL service. I use the method getResource() to get the help information about the script:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:doors="http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/" >
<rdf:Description rdf:about="http://doors-server:port/dwa/rm/dxl/helloWorld">
<doors:help rdf:parseType="Literal"></doors:help>
<rdf:type rdf:resource="http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/DxlServiceResult"/>
</rdf:Description>
</rdf:RDF>
However, when I use updateResource() to invoke the OSLC-DXL service, DOORS responds that is "Unauthorized". I'm executing updateResource() as follows:
client.updateResource(dxlServiceUrl, putBody, OSLCConstants.CT_RDF, OSLCConstants.CT_RDF);
where:
dxlServiceUrl = http://doors-server:port/dwa/rm/dxl/helloWorld
putBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:doors=\"http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/\"><doors:Arguments><doors:arguments>English</doors:arguments></doors:Arguments></rdf:RDF>"
Could you give me an idea about the problem of my solution?
Thanks!!!
|
|
|
|
|
|
Re: OSLC DXL services example [message #1748627 is a reply to message #1715281] |
Fri, 25 November 2016 07:33   |
Eclipse User |
|
|
|
Hi Jim,
I'm sorry about my delay. I solve the problem using the same process to update a requirement.
When I get the DXL service, I get the etag:
ClientResponse clientResponse = connector.getClient().getResource(dxlUrl, OslcMediaType.APPLICATION_RDF_XML);
String etag = clientResponse.getHeaders().getFirst(OSLCConstants.ETAG);
Then, I build the RDF with the information to execute the DXL service and then I execute an update using the given etag:
ClientResponse response = connector.getClient().updateResource(dxlUrl, putBody, OSLCConstants.CT_RDF, OSLCConstants.CT_RDF, etag);
putBody is the buit RDF.
Once I get the response, I process it:
Model model = ModelFactory.createDefaultModel();
model.read(response.getEntity(InputStream.class), dxlUrl);
Property spcPredicate = model.createProperty("http://jazz.net/doors/xmlns/prod/jazz/doors/2.0/", "result");
Selector select = new SimpleSelector(null, spcPredicate, (RDFNode) null);
StmtIterator listStatements = model.listStatements(select);
List<String> result = new ArrayList<String>();
while (listStatements.hasNext()) {
Statement spcStatement = listStatements.nextStatement();
RDFNode node = spcStatement.getObject();
String nodeStr = node.asLiteral().getValue().toString();
result.add(nodeStr);
}
I hope it helps to someone who is blocked with this service.
BR,
Carlos
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10326 seconds