OSLC Requirement Update results with status 412 Precondition Failed
I am developing an OSLC interface to exchange requirements between my product and DOORS. I can import requirements from DOORS; I can create Requirements in DOORS. However, when I try to update with: HttpResponseMessage response = UpdateResource(requirementUrl, requirement, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, etag); I get a HTTP status of 412. As a debugging step I perform: 1.Requirement r = Get Resource () 2. r. Get ETag 3. Update Resource (r) 4. The HTTP status code is 412. ( this seems to indicate that the Requirement is DOORS was updated between the GET and the Update. but I am the only user and I issue the put immediately after the GET) I noticed a similar question from 2012 but there is no answer to that question. All the documentation that I have reviewed seem to indicate the procedure is correct but there must be some implementation issue that I do not understand, I am using DOORS 9.5.2.
Thanks James
|
8 answers
Benjamin Silverman (4.1k●6●10)
| answered May 01 '14, 2:11 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Do you have a stack trace in your rm.log? You can usually work around this by setting com.ibm.rdm.fronting.server.AllowOSLCPutWithOutIfMatchHeader = true (from rm/rmadmin -> Advanced Properties), or setting it in the rm fronting.properties and restarting the server. In the case you enable it from rm/rmadmin, you wont need to restart. But an error log would be useful if that doesn't help.
|
Benjamin - Thanks for taking my question and speedy response. A couple of notes: 1. I am using DOORS 9.5 and I am not aware of an option for configuring AllowOSLCPutWithOutIfMatchHeader. I will research this. 2. My Update Resource request includes the If-Match header (Etag), so would that configuration still be useful? |
I think Ben's comment was based on DOORS Next perspective. He'll correct me if I'm wrong in assuming this..
When you say:
"4. The HTTP status code is 412. ( this seems to indicate that the Requirement is DOORS was updated between the GET and the Update. but I am the only user and I issue the put immediately after the GET)"
How are you inferring requirement in DOORS was updated? If you do a GET again on the resource, do you get a different Etag than what you obtained in your previous GET?
Other than that, just ensure the If-Match header is correctly formed with Etag value in your PUT..
What content are you using to update - are you re-using the response of GET? That's the best way to use..
What resource are you trying to update - object? And it fails on all objects?
|
Sudarshan -
Right, I will have to get the exact message, but while debugging the response included a message indicating that the resource on DOORS had "changed". But my issue could very well be as you suggest that my request is not well formatted with respect to the If-Match header and the ETag. I will take a look at that. I have looked at both the request and response in Fiddler and the request seems to be "Ok" when I compare it to what I see in come OSLC sample request messages.
Thanks James |
Sudarshan -
Not sure if this is useful but thought I would post a sample request/response: Request: PUT http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-O-123-000000a2 HTTP/1.1
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
If-Match: "e1d8db24aae54cd8a41e3ceda5ada737"
Authorization: OAuth oauth_version="1.0",oauth_nonce="v310Z5az",oauth_timestamp="1399053706",oauth_signature_method="HMAC-SHA1",oauth_consumer_key="genesys",oauth_token="1ca2f686-ed58-4773-b126-30fc0812459b",oauth_signature="hArzQp8Y4EUUlDQm6E4mWbvaGdk%3D"
Content-Type: application/rdf+xml
Host: jantoine-xps:8080
Cookie: JSESSIONID=34B235B1AB17424D0CC53ACC5B19E932
Content-Length: 4556
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:ns0="http://open-services.net/ns/rm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<ns0:Requirement rdf:about="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-O-123-000000a2">
<ns1:attrDef-10 xmlns:ns1="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:resource="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/attrDef-10#1" />
<ns2:attrDef-13 xmlns:ns2="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Requirement Short Text</ns2:attrDef-13>
<ns3:attrDef-4 xmlns:ns3="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Administrator</ns3:attrDef-4>
<ns4:attrDef-5 xmlns:ns4="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2014-04-28</ns4:attrDef-5>
<ns5:attrDef-6 xmlns:ns5="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Administrator</ns5:attrDef-6>
<ns6:attrDef-7 xmlns:ns6="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2014-04-28</ns6:attrDef-7>
<ns7:attrDef-8 xmlns:ns7="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">2014-04-28T18:25:57Z</ns7:attrDef-8>
<ns8:attrDef-9 xmlns:ns8="http://jantoine-xps:8080/dwa/rm/urn:rational::1-52e825ce3c6a2b0e-M-000000a2/types/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">123</ns8:attrDef-9>
<ns9:accessControl xmlns:ns9="http://jazz.net/ns/acp#" rdf:resource="http://jantoine-xps:8080/dwa/rm/acp/urn:rational::1-52e825ce3c6a2b0e-F-00000000/2%252Fk%252BVk6BfLFIqG5el2X0bI%252BXzPQ%253D%250A" />
<ns10:allocatedComponent xmlns:ns10="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></ns10:allocatedComponent>
<ns11:basisOf xmlns:ns11="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></ns11:basisOf>
<ns12:genesysId xmlns:ns12="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></ns12:genesysId>
<ns13:genesysName xmlns:ns13="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></ns13:genesysName>
<ns14:heading xmlns:ns14="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Requirement Heading</ns14:heading>
<ns15:primaryText xmlns:ns15="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Requirement_001 Object Text</ns15:primaryText>
<ns16:specifies xmlns:ns16="http://jazz.net/ns/rm#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string"></ns16:specifies>
<ns17:instanceShape xmlns:ns17="http://open-services.net/ns/core#" rdf:resource="http://jantoine-xps:8080/dwa/rm/oslc/shape/requirement/urn:rational::1-52e825ce3c6a2b0e-M-000000a2" />
<ns18:serviceProvider xmlns:ns18="http://open-services.net/ns/core#" rdf:resource="http://jantoine-xps:8080/dwa/rm/discovery/service/urn:rational::1-52e825ce3c6a2b0e-M-000000a2" />
<ns19:shortTitle xmlns:ns19="http://open-services.net/ns/core#" rdf:parseType="Literal">123: Requirement Heading</ns19:shortTitle>
<ns20:contributor xmlns:ns20="http://purl.org/dc/terms/" rdf:resource="http://localhost/" />
<ns21:created xmlns:ns21="http://purl.org/dc/terms/" rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-04-28T04:00:00.000000Z</ns21:created>
<ns22:creator xmlns:ns22="http://purl.org/dc/terms/" rdf:resource="http://localhost/" />
<ns23:description xmlns:ns23="http://purl.org/dc/terms/" rdf:parseType="Literal">Requirement Short Text</ns23:description>
<ns24:identifier xmlns:ns24="http://purl.org/dc/terms/">123</ns24:identifier>
<ns25:modified xmlns:ns25="http://purl.org/dc/terms/" rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-04-28T18:25:57.000000Z</ns25:modified>
<ns26:title xmlns:ns26="http://purl.org/dc/terms/" rdf:parseType="Literal">123: Requirement Heading</ns26:title>
</ns0:Requirement>
Response: HTTP/1.1 412 Precondition Failed
Server: Apache-Coyote/1.1
OSLC-Core-Version: 2.0
Content-Type: application/rdf+xml;charset=UTF-8
Content-Language: en
Content-Length: 310
Date: Fri, 02 May 2014 18:01:47 GMT
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc="http://open-services.net/ns/core#">
<oslc:Error>
<oslc:message>The etag is out of date or is invalid</oslc:message>
<oslc:statusCode>412</oslc:statusCode>
</oslc:Error>
</rdf:RDF>
|
Sorry, did not see the response earlier. Did you manage to get past the problem?
I don't see anything obviously wrong with the request pasted above. Either the error is misleading, or there might be some customization within DOORS that's leading to the problem (that's a far guess though).. You may want to try it out on a simple module (just create a new module with couple of objects and check).
In any case, if it is still an issue, its worth raising a PMR and have it formally investigated.
|
You may also want to turn on advanced logging for DOORS Web Access, and check in oslc.log or oauth.log (these may contain some clue on what's going wrong). Instructions to enable advanced logging can be found here.
|
James,
I don't know if this is still a problem that you're fighting, but I had the same issue. What I was finally able to discover is that ASP.NET's IfMatch tries too hard to follow the standard, whereas DOORS Web Access doesn't. In order to get my app to work, here's what I had to do: etag = "somestring"; //Note that this doesn't do anything special with quotes, so the etag string has no quotes in it, which is contrary to the standard //client is an HttpClient object client.DefaultRequestHeaders.TryAddWithoutValidation("If-Match", etag); Then I add the other information to the request and send it. Once I used that perturbation of the If-Match header, then DOORS Web Access accepted it. |
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.