It's all about the answers!

Ask a question

Error creating a draft work item - oslc rest api


benito neto (626) | asked Jun 01 '15, 2:32 p.m.
edited Jun 01 '15, 2:35 p.m.
I'm trying to create a draft work item by REST OSLC api, but occurred this error:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc="http://open-services.net/ns/core#" >
  <rdf:Description rdf:nodeID="A0">
    <oslc:message>null argument:</oslc:message>
    <oslc:statusCode>500</oslc:statusCode>

    <rdf:type rdf:resource="http://open-services.net/ns/core#Error"/>
  </rdf:Description>
</rdf:RDF>

My code:

writer.append("<rdf:RDF"
                        + " xmlns:dcterms=\"http://purl.org/dc/terms/\""
                        + " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" "
                        + " xmlns:rtc_cm=\"http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/\"  "
                        + " xmlns:oslc_cm=\"http://open-services.net/ns/cm#\" "
                        + " > "
                        + " <rdf:Description rdf:nodeID=\"A0\">"
                        + "  <dcterms:title rdf:parseType=\"Literal\">Sample Work Item benito teste 2</dcterms:title>"
                        + "     <dcterms:type>myworkitem.id</dcterms:type>"
                        + "</rdf:Description>"
                        + "</rdf:RDF>"
                        + "");

        HttpEntity entity = new EntityTemplate(cp);
        HttpPost post = new HttpPost("https://localhost:9443/ccm/oslc/contexts/__BPpZQVkEeWXyenpHV3PTg/drafts/workitems/");          
       
        post.addHeader("Accept", "application/rdf+xml");
        post.addHeader("Content-Type", "application/rdf+xml");
        post.addHeader("OSLC-Core-Version", "2.0");
        post.setEntity(entity);

I read this https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=353253

but i dont kown if is the same problem.

Be the first one to answer this question!


Register or to post your answer.