It's all about the answers!

Ask a question

Is there a solution to oslc.prefix with multiple entries causes a HTTP/1.1 500 Internal Server Error on a RM5.0 server?


Jeff Freeman (1525) | asked Nov 19 '15, 3:35 a.m.
edited Nov 19 '15, 3:40 a.m.

I found an issue what I think to be an issue with multiple items in a oslc.prefix. The issue was found an a larger code base, but to demonstrate the issue on a smaller testcase, I used some example code from the IBM Rational CLM 2012 OSLC Workshop:

I modified Example05 to add an additional term in the oslc.prefix (types). The code passes on a RM4.0 server, but fails on a RM5.0 server.

String oslcSearchByIdentifierQuery = 
    queryCapabilityURI + 
"&oslc.prefix=" +
URLEncoder.encode("dcterms=<http://purl.org/dc/terms/>", "UTF8") + "," +
URLEncoder.encode("types=<http://www.ibm.com/xmlns/rdm/types/>", "UTF8") +
"&oslc.select=" +
URLEncoder.encode("dcterms:title", "UTF8") +
"&oslc.where=" + URLEncoder.encode("dcterms:identifier=" + identifier, "UTF8");

Error message:

java.lang.Exception: Error occured while posting

HTTP/1.1 500 Internal Server Error

      at net.jazz.oslc.utils.HttpUtils.sendPostForSecureDocument(HttpUtils.java:311)

      at net.jazz.oslc.consumer.examples.e05.performQuery(e05.java:110)

      at net.jazz.oslc.consumer.examples.e05.run(e05.java:56)

      at net.jazz.oslc.consumer.examples.e05.main(e05.java:176)


I am using httpclient-4.0.1.jar. Do I need a newer version of the client or is there an update to the workshop code to make it compatible with RM5.0?




Comments
Jeff Freeman commented Nov 19 '15, 3:37 a.m.

Here is the code fragment:

String oslcSearchByIdentifierQuery =
    queryCapabilityURI +
    "&oslc.prefix=" +
    URLEncoder.encode("dcterms=<http://purl.org/dc/terms/>", "UTF8") + "," +
    URLEncoder.encode("types=<http://www.ibm.com/xmlns/rdm/types/>", "UTF8") +
    "&oslc.select=" +
    URLEncoder.encode("dcterms:title", "UTF8") +
    "&oslc.where=" + URLEncoder.encode("dcterms:identifier=" + identifier, "UTF8");

Accepted answer


permanent link
Gabriel Ruelas (1.1k13) | answered Nov 19 '15, 2:03 p.m.
Hi,
 Could you try following options ?
1) Add multiple oslc.properties entries, one for each value
2) URL encode the "," char that separates the entries.

Best Regards.
Jeff Freeman selected this answer as the correct answer

Comments
Jeff Freeman commented Nov 19 '15, 2:58 p.m.

One thing I did not mention is that I post the exact same URL to both servers with the REST API client and I did not receive any HTTP error from the REST client. This seems to me that the apache http client version may need to be updated?

I am not familiar with #1. I will try #2.


Jeff Freeman commented Nov 19 '15, 8:19 p.m.

I tried #2 and there was no difference.


Jeff Freeman commented Nov 19 '15, 10:39 p.m. | edited Nov 19 '15, 11:54 p.m.

I found the answer in the forum:

https://jazz.net/forum/questions/143241/rrc-v405-and-oslc-query

Pls try using an oslc.prefix entry for each namespace definition like :
&olsc.prefix=<dcterms....>&oslc.prefix=<other prefix.....="">


Jeff Freeman commented Nov 19 '15, 10:40 p.m. | edited Nov 19 '15, 11:54 p.m.

Gabriel, you are correct with #1.


From https://jazz.net/forum/questions/143241/rrc-v405-and-oslc-query
Pls try using an oslc.prefix entry for each namespace definition like :
&olsc.prefix=<dcterms....>&oslc.prefix=<other prefix.....="">

One other answer



permanent link
Venkatesh Nadamuni (138) | answered Dec 02 '18, 7:38 p.m.
I specified the following for my query. It ignores the dcterms and returns over 6000 rows. I am using DNG 6.03 and running HTTP-GET on POSTMAN


oslc.query=true&
oslc.prefix=dcterms=<http://purl.org/dc/terms/>&
oslc.prefix=oslc_rm=<http://open-services.net/ns/rm#>&
oslc.select=oslc_rm:uses&
oslc.where=dcterms:identifier=81972

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.