DNG 6.2: Cerating folder in DNG using OSLC
I have been using this code to create the folder in DNG 6.0 but it is not working after we updated to DNG 6.2, getting 500 response code.
String targetProject = "?projectURL=" + webContextUrl + "/process/project-areas/" + projectID; String folderCreationFactory = webContextUrl + "/folders" + targetProject; // Create the body content StringBuffer folderBody = new StringBuffer(); folderBody .append("<rdf:RDF\n") .append("xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns%23\"\n") .append("xmlns:dcterms=\"http://purl.org/dc/terms/\"\n") .append("xmlns:oslc=\"http://open-services.net/ns/core%23\"\n") .append("xmlns:nav=\"http://jazz.net/ns/rm/navigation%23\">\n") .append("<nav:folder rdf:about=\"\">\n") .append("<dcterms:title>" + folderName + "</dcterms:title>\n") .append("<nav:parent rdf:resource=\"" + parentfolder + "\"/>").append("</nav:folder>\n") .append("</rdf:RDF>"); final String content = folderBody.toString(); // Post to the Requirement Factory HttpPost post = new HttpPost(folderCreationFactory); post.addHeader("Accept", "application/xml"); post.addHeader("Content-Type", "application/xml"); post.addHeader("OSLC-Core-Version", "2.0"); post.setEntity(new StringEntity(content, HTTP.UTF_8)); HttpResponse sendPostForSecureDocument = HttpUtils.sendPostForSecureDocument(webContextUrl, post, null, null, client.getHttpClient()); folderLocation = sendPostForSecureDocument.getFirstHeader("Location"); sendPostForSecureDocument.getEntity().consumeContent(); Can anyone help me to resolve the issue. Thanks in advance. |
2 answers
Able to solve the issue just by replacing %23 with #. It sis working on DNG 6.2 not sure %23 not is working when it was fine with 6.0.
Comments
Vaibhav S
commented May 10 '21, 3:30 a.m.
Hi guys,
can you please tell me where can i find the definition of HttpUtils class , many methods are being called from this class like HttpUtils.sendPostForSecureDocument and setupLazy methods etc. i couldnt find this class
Please let me know.
Thanks
Vaibhav
|
I tried the above solution, to create the folder. I did not get any exception but the folder did not get created inside project area.
Comments
Vaibhav S
commented May 10 '21, 3:30 a.m.
Hi guys,
can you please tell me where can i find the definition of HttpUtils class , many methods are being called from this class like HttpUtils.sendPostForSecureDocument and setupLazy methods etc. i couldnt find this class
Please let me know.
Thanks
Vaibhav
|
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.
Comments
I tried doing same with poster but getting 404 error.
<err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
>403</err:errorStatus>
<err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Forbidden</err:errorMessage>
<err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>CRRRS4142E getInternalRequestHandlerService(context) returned null. This error used to report 'The requested service requires a private header'.</err:detailedMessage>
</rdf:Description>
</rdf:RDF>