Removing a Lock
The lock token in the Lock-Token Header identifies the lock that is to be removed. The lock will be removed from the resource at the request URI and from all other resources included in the lock. If every resource that is locked under the submitted lock token cannot be unlocked, then the LOCK Method will fail.
Ending a Transaction
Ending a transaction is similar to removing a lock, except that the lock token submitted in the Lock-Token Header identifies a transaction. In the UNLOCK Method request XML body the client must also specify whether the transaction is to be committed or aborted. To commit the transaction, the commit XML Element must be included within the transactionstatus XML Element of the request body. To abort the transaction, the abort XML Element must be included within the transactionstatus XML Element of the request body.
|204 (No Content)||The command succeeded. Used instead of a 200 (OK) because there is no response entity body.|
|400 (Bad Request)||The lock token submitted corresponds to a transaction and a request XML body was not submitted.|
|424 (Method Failure)||One of the methods in the transaction failed, therefore the entire transaction failed.|
The following example uses the WebDAVUNLOCK Method to successfully remove the lock identified by the lock token "opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1".
UNLOCK /docs/myfile.doc HTTP/1.1 Host: www.contoso.com Lock-Token: <opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1> Authorization: Digest username="user", realm="firstname.lastname@example.org", nonce="...", uri="/docs/myfile.doc", response="...", opaque="..."
The following example uses the WebDAVUNLOCK Method to successfully commit the transaction identified by the lock token "opaquelocktoken:a31d4fce-5dec-17df-2da5-00c0c63bd4eb1".
UNLOCK /public/myfile.doc HTTP/1.1 Host: www.contoso.com Lock-Token: <opaquelocktoken:a31d4fce-5dec-17df-2da5-00c0c63bd4eb1> Content-Type: text/xml <?xml version="1.0" ?> <D:transactioninfo xmlns:D="DAV:"> <D:transactionstatus><D:commit/></D:transactionstatus> </D:transactioninfo>