Uploaded image for project: 'OpenDJ'
  1. OpenDJ
  2. OPENDJ-2303

REST update with HTTP PUT no longer works

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 3.0.0
    • Fix Version/s: Not applicable
    • Component/s: rest
    • Labels:
      None
    • Environment:
      Server built from 3d0d220b76c7218b8fe92b8bddf99424696dbd46

      Description

      The update examples from the Server Dev Guide used to work for 2.6, but no longer seem to work with the HTTP connection handler configured as described.

      In fact it looks like updates using HTTP PUT no longer work in the way described:

      # Read a user entry:
      curl --user kvaughan:bribery "http://opendj.example.com:8080/users/scarter?_prettyPrint=true"
      {
        "_id" : "scarter",
        "_rev" : "0000000082d195c3",
        "schemas" : [ "urn:scim:schemas:core:1.0" ],
        "userName" : "scarter@example.com",
        "displayName" : "Sam Carter",
        "name" : {
          "givenName" : "Sam",
          "familyName" : "Carter"
        },
        "contactInformation" : {
          "telephoneNumber" : "+1 408 555 4798",
          "emailAddress" : "scarter@example.com"
        },
        "meta" : { }
      }
      
      # Update with a copy of the user entry just read:
      curl \
       --request PUT \
       --user kvaughan:bribery \
       --header "Content-Type: application/json" \
       --data '{
         "_id" : "scarter",
         "_rev" : "0000000082d195c3",
         "schemas" : [ "urn:scim:schemas:core:1.0" ],
         "userName" : "scarter@example.com",
         "displayName" : "Sam Carter",
         "name" : {
           "givenName" : "Sam",
           "familyName" : "Carter"
         },
         "contactInformation" : {
           "telephoneNumber" : "+1 408 555 4798",
           "emailAddress" : "scarter@example.com"
         },
         "meta" : { }
       }' \
       "http://opendj.example.com:8080/users/scarter?_prettyPrint=true"
      {
        "code" : 400,
        "reason" : "Bad Request",
        "message" : "The request cannot be processed because it attempts to create the read-only field '/_rev'"
      }
      
      # Try to update again, removing the _rev field.
      curl \
       --request PUT \
       --user kvaughan:bribery \
       --header "Content-Type: application/json" \
       --data '{
         "_id" : "scarter",
         "schemas" : [ "urn:scim:schemas:core:1.0" ],
         "userName" : "scarter@example.com",
         "displayName" : "Sam Carter",
         "name" : {
           "givenName" : "Sam",
           "familyName" : "Carter"
         },
         "contactInformation" : {
           "telephoneNumber" : "+1 408 555 4798",
           "emailAddress" : "scarter@example.com"
         },
         "meta" : { }
       }' \
       "http://opendj.example.com:8080/users/scarter?_prettyPrint=true"
      {
         "code" : 400,
         "reason" : "Bad Request",
         "message" : "The request cannot be processed because it attempts to create the read-only field '/userName'"
      }
      
      # Try to update again, removing the userName field.
      curl \
       --request PUT \
       --user kvaughan:bribery \
       --header "Content-Type: application/json" \
       --data '{
         "_id" : "scarter",
         "schemas" : [ "urn:scim:schemas:core:1.0" ],
         "displayName" : "Sam Carter",
         "name" : {
           "givenName" : "Sam",
           "familyName" : "Carter"
         },
         "contactInformation" : {
           "telephoneNumber" : "+1 408 555 4798",
           "emailAddress" : "scarter@example.com"
         },
         "meta" : { }
       }' \
       "http://opendj.example.com:8080/users/scarter?_prettyPrint=true"
      {
         "code" : 500,
         "reason" : "Internal Server Error",
         "message" : "Operations Error: The Directory Server is currently in the process of closing this client connection"
      }
      

      Meanwhile, tail -f /path/to/opendj/logs/http-access says everything is working fine. Nothing but HTTP 200 OK for the PUT operations:

      -	0:0:0:0:0:0:0:1	kvaughan	24/Sep/2015:17:33:04 +0200	GET	_prettyPrint=true	HTTP/1.1	200	curl/7.43.0	10	4
      -	0:0:0:0:0:0:0:1	kvaughan	24/Sep/2015:17:35:23 +0200	PUT	_prettyPrint=true	HTTP/1.1	200	curl/7.43.0	12	1
      -	127.0.0.1	kvaughan	24/Sep/2015:17:36:09 +0200	PUT	_prettyPrint=true	HTTP/1.1	200	curl/7.43.0	13	1
      -	127.0.0.1	kvaughan	24/Sep/2015:17:37:11 +0200	PUT	_prettyPrint=true	HTTP/1.1	200	curl/7.43.0	14	2
      

      Nothing appears for these operations in logs/access, logs/errors, logs/server.out.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                matthew Matthew Swift
                Reporter:
                Mark Mark Craig
                Dev Assignee:
                Matthew Swift
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: