It's all about the answers!

Ask a question

Lyo OSLC read raw xml rdf response from DOORS

Ahmed Waheed (114) | asked Jul 10 '18, 9:15 a.m.
edited Jul 10 '18, 9:17 a.m.

 I am using the following sample code to retrieve requirements data from DOORS by URL, which is derived from the eclipse lyo code examples, I can see the requirement data parsed into the "requirement" object, but I need to get the raw response (XML RDF) instead

I could not find a method or a field in the "ClientResponse" that returns this raw response.

      ClientResponse response = client.getResource(url, OslcMediaType.APPLICATION_RDF_XML);
      System.setProperty(AbstractOslcRdfXmlProvider.OSLC4J_STRICT_DATATYPES, "false");
      Requirement requirement = new Requirement();
      requirement = response.getEntity(Requirement.class);

Gabriel Ruelas commented Jul 10 '18, 9:52 a.m.


You can load the response in an input stream and then use it to create a Jena Model:

InputStream is = getResponse.getEntity(InputStream.class);
Model model = ModelFactory.createDefaultModel();, ""); 

Best Regards.

Accepted answer

permanent link
Andrew Berezovskyi (763) | answered Jul 17 '19, 9:32 a.m.


The way Gabriel suggests is the most accurate one. The reason is that RDF/XML is not XML but first and foremost, RDF. Also, this is the only "exceptional" entity type can be read for all cases: (I assume you are using the old Lyo Client).

(Eclipse Lyo project lead)

Ralph Schoon selected this answer as the correct answer

2 other answers

permanent link
Jim Amsden (26837) | answered Jul 10 '18, 11:18 a.m.

 Use one of the ClientResponse.getEntity methods.

permanent link
Jean-Luc Johnson (8125) | answered Jul 11 '18, 4:25 a.m.
Hello there.
string rawReq = response.getEntity(String.class);

Your answer

Register or to post your answer.