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

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.

0 votes

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>



2 answers

Permanent link
 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.

1 vote

Comments

 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 


Permanent link

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.
Can you let me know, how programmatically I can create a folder and create a requirement inside that folder?

0 votes

Comments

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

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,941

Question asked: Sep 30 '16, 1:48 a.m.

Question was seen: 3,486 times

Last updated: May 10 '21, 3:30 a.m.

Confirmation Cancel Confirm