WebDAV Protocol

                 

 
Special Edition Using Microsoft SharePoint Portal Server
By Robert  Ferguson

Table of Contents
Chapter  16.   Using WebDAV Protocol to Create Web Parts


In the previous two sections, we introduced the basics of the WSS and a tool that we can use to visually browse, navigate, create, and modify the properties of the items stored in WSS. However, for this purpose we're required to install a client application ”WSS Explorer ”to access the WSS. In this section, we are going to introduce a powerful and robust protocol called Web Distributed Authoring and Versioning (WebDAV) that allows us to modify the contents and their properties over the Web.

WebDAV is an extension to the HTTP1.1 protocol that is accepted as W3C standard and is developed by the Internet Engineering Task Force (IETF), Microsoft, IBM, Novell, Netscape, and other parties to allow authoring and collaboration on the Web. The same way that HTTP changed the face of Internet, WebDAV will create a new milestone on improving the way that we use the Internet. Right now, IIS 5.0, Netscape, Apache, and most major Web servers support WebDAV, and companies are introducing more products that are WebDAV-compliant.

NOTE

In February 1998, IETF's Network Working Group introduced "Requirements for a Distributed Authoring and Versioning Protocol for the World Wide Web" in RFC 2291. After one year of hard work, the committee published "HTTP Extensions for Distributed Authoring ”WEBDAV" in RFC 2518. For more information, you may refer to these RFCs.

http://ietf.org/rfc/rfc2291.txt?number=2291

http://ietf.org/rfc/rfc2291.txt?number=2518


The WebDAV protocol enhanced some of the HTTP1.1 methods and introduced some new methods (Verbs) that allow distributed authoring, collaboration, and search on Web content. Some of the major enhancements have been possible through the following features of WebDAV protocol.

Managing Name Spaces

Like the Universal Resource Locators (URL) that uniquely identify resources on the Web, the concept of Universal Resource Identifier (URI) and Universal Resource Name (URN) provides a mechanism that we can use to uniquely define, identify, and address a specific resource or content on the Web and not have to worry about the collision or conflict of names . For example, a property or field named Name can refer to the name of a person, location, movie, or product. To identify which Name we are referring to requires a context or a Name Space. The name spaces usually look like a URL, such as http://www.compaq.com/product, and the reason behind this widely used syntax is because the URLs are already guaranteed and managed to be unique, or in some cases you will see a Universal Unique Identifier (UUID) as an identifier for name spaces. The following are example of URNs:

 xmlns:a="DAV:"  xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office" 

Notice that each name space starts with the xmlns prefix and a prefix such as a, b, c, or d. This a shorthand for expressing the long name spaces, to make them more readable and easier to type, and also reduces that amount of data that needs to be transmitted over wire. The following are examples of addressing each property in a specific name space:

 <a:response>  <a:href> <a:displayname> <a:getlastmodified b:dt="dateTime.tz"> <d:author> <d:title> 

New Methods

WebDAV also extends the HTTP1.1 protocol by introducing new methods such as

  • PropFind, which can be used for retrieval of content based on the properties of the content.

  • PropPatch, which can be used for setting or removing properties of the content.

  • Mkcol, which can be used to create collections such as Web folders.

  • Copy / Move, which can be used for copying and moving a single unit of content or a collection from a source to a destination.

  • Lock / Unlock, which can be used to protect "lost updates" and provide a mechanism for collaboration.

Later in this chapter, we will see sample code to show how these methods can be used.

WebDAV and XML

In HTTP, the main mechanism for passing parameters and data to a server was through query strings, or using POST with the form data. Using XML extends this capability by allowing the requests to be sent in XML format, and also increases the capability of the server for sending responses using XML. XML is a flexible and extensible markup language that empowers WebDAV for multi-processing, managing collections, representing hierarchical data, and addressing the properties within name spaces, features that were not possible in HTTP1.1. Built-in support for multiple character set encodings in XML extends and simplifies the internationalization capabilities of HTTP. XML also is known and accepted as an industry standard for interoperability and communication with different platforms, which makes XML an excellent fit for WebDAV, which was primarily designed for authoring in a distributed environment.

New HTTP Headers

Another of WebDAV's enhancements to HTTP1.1 is the introduction of new keywords in the request header, and some of them are as follows :

  • DAV Header, which indicates that the head resource supports WebDAV protocol. If the request header has a DAV header, it means that the resource supports the WebDAV schema and protocol.

  • Depth Header, which indicates the level of hierarchy through one of three parameters:

    "0" mean the resource itself.

    "1" means the resource and its immediate children.

    "infinity" means the entire tree, which is also the default if we don't use the depth header keyword.

  • Destination Header, which must be indicated whenever we are using methods that require a destination, such as move or copy.

  • Overwrite Header, which can take the value "F" to prevent overwriting the destination if it has the same name as the resource in a COPY or MOVE method, or "T" for overwriting, which is default value if it is not included in the header.

New Status Code

HTTP has five general status code categories that are returned by the server in response to the client's request. The first digit of the status code defines the class of response. The last two digits do not have any categorization role. These five categories are as follows (see RFC 2616):

Informational 1xx ” The request is received and processing.

Successful 2xx ” The action is received, understood , and accepted.

Redirection 3xx ” To complete the request, further action is required.

Client Error 4xx ” The request has bad syntax or cannot be fulfilled.

Server Error 5xx ” Server has failed to respond to the request.

WebDAV protocol has introduced some new status codes, such as

  • 102 Processing ” indicates that the server has received the request and is processing it.

  • 207 Multi-Status ” unlike HTTP1.1, which could only return one status code, WebDAV can have multiple statuses for a request returned in a single XML format.

  • 423 Locked ” indicates that the source or destination is locked.

  • 424 Failed Dependency ” in a series of actions on a resource, one action failed because of its dependency on a prior action that previously failed.

This is WebDAV in a nutshell , and by now we should have a big picture of the capabilities of this protocol. In the next sections, we will present sample code that shows some of these methods, and what you need to take advantage of this powerful protocol.


                 
Top


Special Edition Using Microsoft SharePoint Portal Server
Special Edition Using Microsoft SharePoint Portal Server
ISBN: 0789725703
EAN: 2147483647
Year: 2002
Pages: 286

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