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

Lyo OSLC read raw xml rdf response from DOORS

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

0 votes

Comments

Hi,

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();
 model.read(is, ""); 

Best Regards.


Accepted answer

Permanent link

 Ahmed,


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: https://wink.apache.org/documentation/1.0/api/org/apache/wink/client/ClientResponse.html#getEntity(org.apache.wink.client.EntityType) (I assume you are using the old Lyo Client).

Cheers,
Andrew
(Eclipse Lyo project lead)

Ralph Schoon selected this answer as the correct answer

0 votes


2 other answers

Permanent link

 Use one of the ClientResponse.getEntity methods.

0 votes


Permanent link
Hello there.
Try
string rawReq = response.getEntity(String.class);

0 votes

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,937
× 516
× 25

Question asked: Jul 10 '18, 9:15 a.m.

Question was seen: 2,873 times

Last updated: Jul 17 '19, 9:32 a.m.

Confirmation Cancel Confirm