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

OSLC update API and the RRC4.0

We have been trying to update a requirement through the OSLC API ,we were able to properly form the update query and the query is running fine i.e no error response message is coming (status 200 ok) but the issue is when we are looking in RRC UI there is no update reflected.

Can you please let me know where M doing wrong or is there any special header/ httpPut request needs to be fromed or there is extra feature required fro update to be reflected in UI.

1

0 votes

Comments

I am also seeing the same issue while updating the Requirement using REST API. I get the response code as 200 but update is not being reflected.

Header value content length: 0
    - Server: Apache-Coyote/1.1
    - OSLC-Core-Version: 2.0
    - ETag: "_qXxf8uhKEeGQ1_oJ08nXmQ"
    - Content-Type: application/rdf+xml
    - Transfer-Encoding: chunked
    - Date: Fri, 17 Aug 2012 10:37:58 GMT
eTagValue"_qXxf8uhKEeGQ1_oJ08nXmQ"
>> First PUT URI: https://j<myServer>:9443/rm/resources/_qXvqwehKEeGQ1_oJ08nXmQ
>> Response Code  on First PUT: 200
>> Response Headers on First PUT:
    - Server: Apache-Coyote/1.1
    - OSLC-Core-Version: 2.0
    - Content-Type: application/xml
    - Transfer-Encoding: chunked
    - Date: Fri, 17 Aug 2012 10:37:59 GMT
in Main Method
response code: 200
Response Header:
    - Server: Apache-Coyote/1.1
    - OSLC-Core-Version: 2.0
    - Content-Type: application/xml
    - Transfer-Encoding: chunked
    - Date: Fri, 17 Aug 2012 10:37:59 GMT
Response Body:



the header i am setting while doing put :
            rmPUT.addHeader("Accept", "application/rdf+xml");
            rmPUT.addHeader("Content-Type", "application/rdf+xml");
            rmPUT.addHeader("OSLC-Core-Version", "2.0");
            rmPUT.addHeader("If-Match", rmeTagValue);


Accepted answer

Permanent link
Hi,
The steps to update an existing artifact in RRC 4.0 are:

1) Get the resource you are trying to update, use following header in the request:
OSLC-Core-Version=2.0
Accept=application/rdf+xml

It should return the rdf+xml content and some headers.

2) Do a Put to the resource using following information returned in step one :
Add headers :
OSLC-Core-Version=2.0
Accept=application/rdf+xml
From the headers returned in step 1, get the value of header "Etag" and add it to a If-Match header, for instance :
If-Match= "_HT1a0eGhEeGWkeyF2C15GA"    

Modify the rdf+xml content recieved and add it to the body of the put request, Select the content type as: application/rdf+xml

Refresh ( F5 ) your browser to verify your changes.
   
Banshri Kundu selected this answer as the correct answer

0 votes

Comments

Thanks for the reply, that was really helpful.

Actually I downloaded the OSLC workshop material from https://jazz.net/library/content/articles/rtc/2.0.0.2/oslc-extensions-workshop/ and tried to update the requirement but no result, it is using the same process as you mentioned.

I used the Example04.java for your reference.but it dint worked.

Also I even tried to modify the java file to update the 'primary text (rich text content) ' of the requirement and updated the headers as you mentioned but it dint worked. i.e there is no error in the Put response message and no UI change.

Can you help me share the code piece of how to update the rdf+xml content of the 'primary text feild'

Hi, Which type of resource are your trying to update? Text ?

The OSLC workshop code have an issue when running against a server 4.0 or above. To fix it you must replace following method in the Example04.java.

protected String findPropertyByTitle(Document doc, String title) throws Exception {
        // Vocabulary Support
        // based on last Resource shapes changes we need to use dcterms:title to get the property name
        String propertyDefinition = "//oslc:Property[dcterms:title=\"" + title +"\"]/oslc:propertyDefinition/@rdf:resource";
        XPath xpathNamespace = getXpathNamespace();
        Node node = (Node) xpathNamespace.evaluate(propertyDefinition, doc, XPathConstants.NODE);
        if(node != null){
            return node.getTextContent();
        }
        return null;
    }

With this change code must be able to update the Primary text.  PLS let me know if questions

I followed the guidelines outlined in the accepted answer on this solution, but it doesn't work. I received the following error:

Error Detailed Message:

CRRRS6402E Content is not allowed. Content type must be application/rdf+xml (More info found at entry [f1d83c8fad4ba7ec] in the RM application server log)

Error Message:

Not acceptable

Error Status:

406

As a sanity check, I sent the exact same response back to the server in my PUT request without modifying any of the content. I requested the data in application/rdf+xml and I sent it back with the same header applied.

I note that the content is HTML text which is similar in appearance to XML. Perhaps the server thinks the HTML is part of the XML structure and is not formatted correctly?

OLSC Service only updated artifact of Type Text or Collection, graphical artifacts or other are not updated. That support will come in next release under wi 85844

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

Question asked: Aug 09 '12, 5:39 a.m.

Question was seen: 3,983 times

Last updated: Apr 14 '14, 9:20 p.m.

Confirmation Cancel Confirm