Is there a solution to oslc.prefix with multiple entries causes a HTTP/1.1 500 Internal Server Error on a RM5.0 server?
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?
Accepted answer
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.
Comments
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.
I tried #2 and there was no difference.
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.....="">
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
Comments
Jeff Freeman
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");