A.3 Microsoft WebDAV

Microsoft implements a number of useful extensions to WebDAV in their WebDAV servers. Some are rather difficult to use, but some have simple syntax and straightforward usage.

A.3.1 Microsoft Row Extension to Range Header

The Range header (described in Chapter 3, HTTP Mechanics) is an HTTP/1.1 header that can be used to limit the number of bytes the server will return in response to a method such as GET. The Range header is quite useful for clients to resume interrupted download requests. A quick example to recall the format of this header:

 
 Range: bytes=0-1000 

Since WebDAV PROPFIND requests can also produce long responses, it could be quite useful to have a similar mechanism for PROPFIND. However, there's a better way to limit the size of the response, and that is to ask the server for a limited number of resource responses, rather than a limited number of bytes. The resource responses are analogous to rows in a table, so the Microsoft-defined custom Range header syntax calls them rows. For example:

 
 Range: rows=0-24 

With this header on a PROPFIND request, some Microsoft WebDAV servers (Exchange 2000, Sharepoint, perhaps others) will return only 25 response elements in the PROPFIND response. Even if the collection contains hundreds of resources, properties are returned for only 25 of them. If this is sufficient to fill up a screen in a client UI, then there's no need for the client to immediately download more information than is required to fill up the screen. Later, the client can ask for "rows = 25 100" to get more responses if necessary. Note that this assumes that the server applies some type of consistent ordering to PROPFIND responses, although it doesn't say what ordering that must be.

The complete syntax of the rows extension to the Range header is the same as that for bytes (e.g., the last 100 rows can be requested with "rows = 100 ").

A.3.2 Property Name and Namespace Concatenation

Many existing Microsoft tools have been adapted over the past few years to integrate with WebDAV. One of the popular ways to do this is to use the Microsoft OLE DB Provider for Internet Publishing, a.k.a. MSDAIPP (I'm not responsible for the acronym having little to do with the full name, that's just what the DLL is called). MSDAIPP is a client library providing an OLEDB interface for the application to use and translating requests to WebDAV to send to the server. One challenge in implementing this component was that OLEDB doesn't have the concept of namespaces. The implementors needed a way to handle namespaces and property names together so that the OLEDB layer could translate a request for a property into the full WebDAV PROPFIND format complete with namespaces.

The rules for namespace/name concatenation are useful in other places as well, such as in the SQL SEARCH statements, where SELECT and WHERE clauses need to name columns. The property namespace/name combination is used as a column name in SQL requests.

  1. If the namespace name ends with a :, \, or / character, concatenate the property name directly onto the namespace name. For example:

    The displayname property

    in the DAV: namespace

    becomes DAV:displayname

    The rank property

    in the urn:schemas.microsoft.com:fulltextqueryinfo: namespace

    becomes urn:schemas.microsoft.com:fulltextqueryinfo:rank.

  2. If the namespace name ends with another character, concatenate a # character onto the namespace before adding the property value. Thus:

    The Title property

    in the urn:schemas-microsoft-com:office:office namespace

    becomes urn:schemas-microsoft-com:office:office#Title.

  3. This transformation is reversible. To decompose a concatenated property string into its namespace name and property name, look for the last instance in the string of any of the characters :, \, /, or #. That is the separator character. If the separator character is #, remove it; otherwise, keep the separator character as part of the namespace name, and the rest of the string is the property name.

A.3.3 SQL SEARCH Syntax

Microsoft implemented an HTTP method called SEARCH in its Exchange 2000 and Sharepoint servers. Although a couple of IETF Internet Drafts have proposed SEARCH methods and syntaxes, Microsoft's implementations do not conform to any of these proposals. (Note that none of the proposals were made into standards at the time and still aren't standardized at the writing of this appendix.)

The Microsoft SEARCH method syntax simply embeds a SQL statement inside an XML body in the SEARCH request:

 
 <?xml version="1.0"?> <DAV:searchrequest>    <DAV:sql>       sql-select-statement    </DAV:sql> </DAV:searchrequest> 

In addition, the SEARCH request requires a couple HTTP headers in order to work completely. The headers required for Sharepoint are covered in Sharepoint documentation, which can be found online.

Like the Internet Draft SEARCH proposal, the Microsoft SEARCH format is intended to be able to search property values on WebDAV resources as well as the bodies of those resources. Thus, SQL SELECT statements and WHERE clauses must be able to name property names. The mapping between WebDAV property names and SQL statement column names is pretty straightforward, even though strictly speaking there's no such thing as a "table" with "columns" in a WebDAV repository. The concatenation trick described in the previous section allows the property namespace to be included as well as the property name.

Building SQL Statements

Once we know how to build property and namespace concatenated strings, we can use those in the SQL statements in SEARCH requests. The property strings are quoted. If we want to find the displayname property value for every resource of size greater than 10000 bytes within /hr/, this is the SQL statement to use.

 
 SELECT "DAV:displayname"    FROM SCOPE ('DEEP TRAVERSAL OF "/hr/"')    WHERE ("DAV:getcontentlength" > 10000) 

Notice the FROM clause names a WebDAV collection and a scope or depth. This scope overrules the Depth header value, which is ignored.

To put this SQL statement inside the XML body of the SEARCH request, the characters &, >, and < must be escaped first. The body of the SEARCH request will be:

 
 <?xml version="1.0"?> <DAV:searchrequest>    <DAV:sql>       SELECT "DAV:displayname"          FROM SCOPE ('DEEP TRAVERSAL OF "/hr/"')          WHERE ("DAV:getcontentlength" &gt; 10000)    </DAV:sql> </DAV:searchrequest> 

Finally, the SEARCH method takes a couple of headers that may modify how the server responds. The same range rows header that works for PROPFIND works for the SEARCH request:

 
 SEARCH /hr/ HTTP/1.1 Host: www.example.com Range: rows=0-39 Content-type: text/xml Content-length: xxx 

The Microsoft Developer Network (MSDN) has further information on this and other special Microsoft request methods and headers.



WebDAV. Next Generation Collaborative Web Authoring
WebDAV. Next Generation Collaborative Web Authoring
ISBN: 130652083
EAN: N/A
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net