At Software WithStyle, with our beta release of XML WithStyle, we've already begun on the next set of jobs to get it to a 1.0 production release.
One of the jobs on my todo list is to add WebDAV support to it. To do that, I needed our code base to be able to support the core WebDAV API.
WebDAV is what lets users around the world add a 'Web Folder' in Windows Explorer and Microsoft Word and many other products. WebDAV is without a doubt a huge success. It works well and provides everything you need in a basic read-write web protocol.
It turns out that the designers of WebDAV did the right thing - they didn't use copious web services. Instead, they added a few more commands to HTTP.
Commands that come with HTTP/1.1: GET, PUT, DELETE
Commands added with WebDAV: PROPFIND, PROPPATCH, LOCK, UNLOCK, MKCOL
To Get/Put things in to a WebDAV directory is easy - you can do that without even knowing WebDAV, just HTTP/1.1. You simply use GET and PUT. Where the interesting stuff happens is with WebDAV directories (or 'Collections' as they are called).
You can make a collection using MKCOL. Then you can use PROPFIND to see what's inside a collection. Thus, you can now navigate a remote repository, adding and removing things at will.
I've added a new package to Public Store which is a companion to NetResources and NetResourcesHTTP called NetResourcesWebDAV. With it comes a new set of API's that will work on HTTP or FILE URL's.
'http://myserver/webdav/' asURI propFind
'http://myserver/webdav/' asURI makeResourceCollection
'http://myserver/webdav/mydocument.txt' asURI resourceLockExclusive
'http://myserver/webdav/mydocument.txt' asURI resourceLockShared
'http://myserver/webdav/mydocument.txt' asURI resourceUnlock
'http://myserver/webdav/' asURI propPatch: someWebDavCommands
'http://myserver/webdav/a.txt' asURI resourceCopyTo: 'http://myserver/webdav/b.txt' asURI
'http://myserver/webdav/a.txt' asURI resourceMoveTo: 'http://myserver/webdav/b.txt' asURI
'http://myserver/webdav/' asURI isResourceCollection
From there you can do whatever you want. The lock/unlock commands are completely automatic. You lock a resource and it remembers the lock token for you, then when you unlock (or try to lock again) it'll unlock using the same token.
You're on your own if you want to interpret the results of a propFind or propFind:
Enjoy